1 // Compiler options: -langversion:default
4 using System
.Collections
;
6 public class Foo
: IDisposable
8 public readonly int Data
;
17 public void Dispose ()
25 public static IEnumerable
Test (int a
, int b
)
29 using (Foo foo1
= new Foo (a
), foo2
= new Foo (b
)) {
30 yield return foo1
.Data
;
31 yield return foo2
.Data
;
37 yield return foo3
.disposed
;
38 yield return foo4
.disposed
;
41 public static int Main ()
43 ArrayList list
= new ArrayList ();
44 foreach (object data
in Test (3, 5))
49 if ((int) list
[0] != 3)
51 if ((int) list
[1] != 5)