Debian Codegraph @

mcs/tests/gtest-anontype-02.cs

raw symbols SCIP
1
2 // Tests anonymous types initialized with local variables
3 using System;
4 using System.Collections;
5
6 public class Test
7 {
8 static object TestA (string s)
9 {
10 return new { s };
11 }
12
13 public static int Main ()
14 {
15 string Foo = "Bar";
16 int Baz = 42;
17 var v = new { Foo, Baz };
18
19 if (v.Foo != "Bar")
20 return 1;
21 if (v.Baz != 42)
22 return 2;
23
24 if (!TestA ("foo").Equals (new { s = "foo" }))
25 return 3;
26
27 Console.WriteLine ("OK");
28 return 0;
29 }
30 }