This code is contributed under the MIT X11 license
[mono.git] / mcs / tests / gtest-anontype-02.cs
diff --git a/mcs/tests/gtest-anontype-02.cs b/mcs/tests/gtest-anontype-02.cs
new file mode 100644 (file)
index 0000000..0be6afe
--- /dev/null
@@ -0,0 +1,21 @@
+// Compiler options: -langversion:linq
+// Tests anonymous types initialized with local variables
+using System;
+using System.Collections;
+
+public class Test
+{
+       static int Main ()
+       {
+               string Foo = "Bar";
+               int Baz = 42;
+               var v = new { Foo, Baz };
+               
+               if (v.Foo != "Bar")
+                       return 1;
+               if (v.Baz != 42)
+                       return 2;
+               
+               return 0;
+       }
+}