泛型委托
public static void TraditionalDelegateSyntax()
{
List<int> list = new List<int>();
list.AddRange(new int[] { 1, 5, 10, 20, 33 });
Predicate<int> callback = new Predicate<int>(IsEvenNumber);//使用传统委托语法调用FindAll
List<int> evenNumbers = list.FindAll(callback);
foreach (int num in evenNumbers)
Console.Write("{0}\t", num);
//Output: 10 20
}
// Predicate<>委托的目标
static bool IsEvenNumber(int i)
{ return (i % 2) == 0; }