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

gtest-061.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d034e23c63d97b84050f353245b51435a968305b (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
30
31
32
using System;

public delegate B Test<A,B> (A a);

public class Foo<T>
{
	T t;

	public Foo (T t)
	{
		this.t = t;
	}

	public U Method<U> (Test<T,U> test)
	{
		return test (t);
	}
}

class X
{
	public static void Main ()
	{
		Test<double,int> test = new Test<double,int> (Math.Sign);

		Foo<double> foo = new Foo<double> (Math.PI);
		Console.WriteLine (foo.Method<int> (test));

		string s = foo.Method<string> (delegate (double d) { return "s" + d; });
		Console.WriteLine (s);
	}
}