2010-02-20 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / test-727.cs
blob913a5ea79708b1c624221217d2427ee65ab49b99
1 using System;
3 namespace IDisposableTest
5 class MainClass
7 public static int Main ()
9 using (Foo f = new Foo ())
12 Console.WriteLine ("Between. Foo.TotalInstances = " + Foo.TotalInstances);
14 using (IDisposable f = new Foo ())
17 Console.WriteLine ("After. Foo.TotalInstances = " + Foo.TotalInstances);
19 if (Foo.TotalInstances != 2)
20 return 1;
22 return 0;
27 class Foo : IDisposable
29 public static int TotalInstances = 0;
31 private int my_a = 0;
33 public Foo ()
35 my_a = TotalInstances++;
36 Console.WriteLine ("Instance " + my_a + " ctor");
39 public void Dispose ()
41 Console.WriteLine ("Instance " + my_a + " Dispose()");