Wed Oct 17 13:24:33 CEST 2007 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / tests / gtest-var-05.cs
1 // Compiler options: -langversion:linq
2 // Tests variable type inference with the var keyword when using the "using" statement
3 using System;
4
5 public class MyClass : IDisposable
6 {
7         private string s;
8         public MyClass (string s)
9         {
10                 this.s = s;
11         }
12         public void Dispose()
13         {
14                 s = "";
15         }
16 }
17
18 public class Test
19 {
20         static int Main ()
21         {
22                 using (var v = new MyClass("foo"))
23                         if (v.GetType() != typeof (MyClass))
24                                 return 1;
25                 
26                 return 0;
27         }
28 }