2 using System.Collections;
4 public class Foo : IDisposable
6 public readonly int Data;
15 public void Dispose ()
23 public static IEnumerable Test (int a, int b)
27 using (Foo foo1 = new Foo (a), foo2 = new Foo (b)) {
28 yield return foo1.Data;
29 yield return foo2.Data;
35 yield return foo3.disposed;
36 yield return foo4.disposed;
41 ArrayList list = new ArrayList ();
42 foreach (object data in Test (3, 5))
47 if ((int) list [0] != 3)
49 if ((int) list [1] != 5)