[sdks] Fix README.md
[mono-project.git] / mcs / tests / gtest-078.cs
blob46ec88e450573f3780cf354d2341a1ab335452ea
1 using System;
3 struct S : IDisposable
5 public static int hit;
7 void IDisposable.Dispose ()
9 hit++;
12 public void Dispose ()
14 throw new ApplicationException ();
18 class C : IDisposable
21 void IDisposable.Dispose ()
25 public void Dispose ()
27 throw new ApplicationException ();
31 class Test
33 public static int Main ()
35 S? nullable = null;
36 using (var a = nullable) {
39 if (S.hit != 0)
40 return 1;
42 using (var s = new S ()) {
45 if (S.hit != 1)
46 return 2;
48 C c = null;
49 GenMethod (c);
51 using (S? a = nullable, b = nullable) {
54 if (S.hit != 1)
55 return 3;
57 Console.WriteLine ("ok");
58 return 0;
61 static void GenMethod<T> (T t) where T : IDisposable
63 using (T t2 = t) {