remove NotWorking
[mcs.git] / tests / test-anon-12.cs
blobd2265a53b9049ce0b647932dbd1875795372738b
1 using System;
2 using System.Collections;
4 delegate bool predicate (object a);
6 class X {
8 static int Main ()
10 ArrayList a = new ArrayList ();
11 for (int i = 0; i < 10; i++)
12 a.Add (i);
14 ArrayList even = Find (delegate (object arg) {
15 return ((((int) arg) % 2) == 0);
16 }, a);
18 Console.WriteLine ("Even numbers");
19 foreach (object r in even){
20 Console.WriteLine (r);
22 if (even.Count != 5)
23 return 1;
24 if (((int)even [0]) != 0 ||
25 ((int)even [1]) != 2 ||
26 ((int)even [2]) != 4 ||
27 ((int)even [3]) != 6 ||
28 ((int)even [4]) != 8)
29 return 2;
31 return 0;
34 static ArrayList Find (predicate p, ArrayList source)
36 ArrayList result = new ArrayList ();
38 foreach (object a in source){
39 if (p (a))
40 result.Add (a);
43 return result;