2010-04-06 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-anontype-04.cs
blobfa80a02777edf04713a9a991dcf7a24d05708453
2 // Tests anonymous types initialized with a mix of literals, local variables and object members
3 using System;
4 using System.Collections;
6 public class MyClass
8 public string Foo = "Bar";
9 public int Baz {
10 get { return 16; }
14 public class Test
16 static int Main ()
18 string Hello = "World";
19 MyClass mc = new MyClass();
20 var v = new { mc.Foo, mc.Baz, Hello, Answer = 42 };
22 if (v.Foo != "Bar")
23 return 1;
24 if (v.Baz != 16)
25 return 2;
26 if (v.Hello != "World")
27 return 3;
28 if (v.Answer != 42)
29 return 4;
31 return 0;