2007-05-25 Jonathan Chambers <joncham@gmail.com>
[mcs.git] / tests / gtest-anontype-04.cs
blob1d1fef842fa304f15acb1b66f0afa194398f5b27
1 // Compiler options: -langversion:linq
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;