using System;
using System.Collections.Generic;
public class Example
{
public static void Main()
{
List myList = new List();
myList.Add("A");
myList.Add("B");
myList.Add("C");
Console.WriteLine();
foreach (string d in myList)
{
Console.WriteLine(d);
}
Console.WriteLine(myList.TrueForAll(myFunc));
Console.WriteLine(myList.Find(myFunc));
Console.WriteLine(myList.FindLast(myFunc));
List sublist = myList.FindAll(myFunc);
foreach (string d in sublist)
{
Console.WriteLine(d);
}
Console.WriteLine(myList.RemoveAll(myFunc));
foreach (string d in myList)
{
Console.WriteLine(d);
}
Console.WriteLine(myList.Exists(myFunc));
}
private static bool myFunc(String s)
{
if ((s.Length > 5) &&
(s.Substring(s.Length - 6).ToLower() == "C"))
{
return true;
}
else
{
return false;
}
}
}