Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-anontype-03.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 030c110f11a229efc20a72d0cd138b964e19deec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

// Tests anonymous types initialized with object members
using System;
using System.Collections;

public class MyClass
{
	public string Foo = "Bar";
	public int Baz {
		get { return 42; }
	}
}

public class Test
{
	public static int Main ()
	{
		MyClass mc = new MyClass();
		var v = new { mc.Foo, mc.Baz };
		
		if (v.Foo != "Bar")
			return 1;
		if (v.Baz != 42)
			return 2;
			
		return 0;
	}
}