2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-var-02.cs
blob46fe49daec12f48f2ec1b823a8bce169a8a029d6
2 // Tests variable type inference with the var keyword when assigning to user-defined types
3 using System;
5 public class Class1
7 public bool Method()
9 return true;
11 public int Property = 16;
14 public class Test
16 private class Class2
18 public bool Method()
20 return true;
22 public int Property = 42;
24 static int Main ()
26 var class1 = new Class1 ();
28 if (class1.GetType () != typeof (Class1))
29 return 1;
30 if (!class1.Method ())
31 return 2;
32 if (class1.Property != 16)
33 return 3;
35 var class2 = new Class2();
37 if (class2.GetType () != typeof (Class2))
38 return 4;
39 if (!class2.Method ())
40 return 5;
41 if (class2.Property != 42)
42 return 6;
44 return 0;