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

gtest-045.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 36d4b2d9977c655998e58ba27f220e03f5e0371c (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
29
// Important test: Type inference

class Test<A,B>
{
	public void Foo<U> (U u)
	{ }

	public void Foo<V> (V[] v, V w)
	{ }

	public void Hello<V,W> (V v, W w, Test<V,W> x)
	{ }

	public void ArrayMethod<V> (params V[] args)
	{ }
}

class X
{
	public static void Main ()
	{
		Test<float,int> test = new Test<float,int> ();
		test.Foo ("Hello World");
		test.Foo (new long[] { 3, 4, 5 }, 9L);
		test.Hello (3.14F, 9, test);
		test.ArrayMethod (3.14F, (float) 9 / 3);
	}
}