linux-packaging-mono/mcs/tests/gtest-anontype-02.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

31 lines
460 B
C#

// Tests anonymous types initialized with local variables
using System;
using System.Collections;
public class Test
{
static object TestA (string s)
{
return new { s };
}
public 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;
if (!TestA ("foo").Equals (new { s = "foo" }))
return 3;
Console.WriteLine ("OK");
return 0;
}
}