remove debug writelines
[mcs.git] / tests / test-iter-08.cs
blob3b7b4b9e517fe168fc275fa5d8c90de0be26fd4f
1 // Compiler options: -langversion:default
3 using System;
4 using System.Collections;
6 public class Foo : IDisposable
8 public readonly int Data;
10 public Foo (int data)
12 this.Data = data;
15 public bool disposed;
17 public void Dispose ()
19 disposed = true;
23 class X
25 public static IEnumerable Test (int a, int b)
27 Foo foo3, foo4;
29 using (Foo foo1 = new Foo (a), foo2 = new Foo (b)) {
30 yield return foo1.Data;
31 yield return foo2.Data;
33 foo3 = foo1;
34 foo4 = foo2;
37 yield return foo3.disposed;
38 yield return foo4.disposed;
41 static int Main ()
43 ArrayList list = new ArrayList ();
44 foreach (object data in Test (3, 5))
45 list.Add (data);
47 if (list.Count != 4)
48 return 1;
49 if ((int) list [0] != 3)
50 return 2;
51 if ((int) list [1] != 5)
52 return 3;
53 if (!(bool) list [2])
54 return 4;
55 if (!(bool) list [3])
56 return 5;
58 return 0;