1 // Compiler options: -langversion:default
4 using System.Collections;
8 public IEnumerable Foo (int a)
14 Console.WriteLine ("Hello World");
17 Console.WriteLine ("Next block");
22 Console.WriteLine ("Boston");
25 Console.WriteLine ("Outer finally");
28 Console.WriteLine ("Outer block");
37 Test test = new Test ();
39 ArrayList list = new ArrayList ();
40 foreach (object o in test.Foo (5))
45 if ((int) list [0] != 5)
47 if ((int) list [1] != 25)
50 IEnumerable a = test.Foo (5);
52 IEnumerator b = a as IEnumerator;
58 IEnumerator c = a.GetEnumerator ();
61 if ((int) c.Current != 5)
65 if ((int) c.Current != 25)
68 IEnumerator d = a.GetEnumerator ();
70 if ((int) c.Current != 25)
74 if ((int) c.Current != 25)
76 if ((int) d.Current != 5)
82 ((IDisposable) a).Dispose ();