2010-05-31 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-anontype-02.cs
blob99779fa8cb78a89e4a4d47cdd288bc68ffa5cc55
2 // Tests anonymous types initialized with local variables
3 using System;
4 using System.Collections;
6 public class Test
8 static object TestA (string s)
10 return new { s };
13 static int Main ()
15 string Foo = "Bar";
16 int Baz = 42;
17 var v = new { Foo, Baz };
19 if (v.Foo != "Bar")
20 return 1;
21 if (v.Baz != 42)
22 return 2;
24 if (!TestA ("foo").Equals (new { s = "foo" }))
25 return 3;
27 Console.WriteLine ("OK");
28 return 0;