2 using System.Collections;
6 public IEnumerable Foo (int a)
12 Console.WriteLine ("Hello World");
15 Console.WriteLine ("Next block");
20 Console.WriteLine ("Boston");
23 Console.WriteLine ("Outer finally");
26 Console.WriteLine ("Outer block");
35 Test test = new Test ();
37 ArrayList list = new ArrayList ();
38 foreach (object o in test.Foo (5))
43 if ((int) list [0] != 5)
45 if ((int) list [1] != 25)
48 IEnumerable a = test.Foo (5);
50 IEnumerator b = a as IEnumerator;
56 IEnumerator c = a.GetEnumerator ();
59 if ((int) c.Current != 5)
63 if ((int) c.Current != 25)
66 IEnumerator d = a.GetEnumerator ();
68 if ((int) c.Current != 25)
72 if ((int) c.Current != 25)
74 if ((int) d.Current != 5)
80 ((IDisposable) a).Dispose ();