2 using System
.Collections
;
4 delegate bool predicate (object a
);
10 ArrayList a
= new ArrayList ();
11 for (int i
= 0; i
< 10; i
++)
14 ArrayList even
= Find (delegate (object arg
) {
15 return ((((int) arg
) % 2) == 0);
18 Console
.WriteLine ("Even numbers");
19 foreach (object r
in even
){
20 Console
.WriteLine (r
);
24 if (((int)even
[0]) != 0 ||
25 ((int)even
[1]) != 2 ||
26 ((int)even
[2]) != 4 ||
27 ((int)even
[3]) != 6 ||
34 static ArrayList
Find (predicate p
, ArrayList source
)
36 ArrayList result
= new ArrayList ();
38 foreach (object a
in source
){