update readme (#21797)
[mono-project.git] / mcs / tests / gtest-anontype-02.cs
blobd2404d9f7514d3cdba4d26008351871c3f98e4c8
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 public 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;