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

test-26.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8914ae61a817917c506f7f18940fc12099310b8e (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
33
34
35
using System;

public class Blah {

	public delegate int MyDelegate (int i, int j);
	
	public int Foo (int i, int j)
	{
		return i+j;
	}

	public static int Main ()
	{
		Blah f = new Blah ();

		MyDelegate del = new MyDelegate (f.Foo);

		MyDelegate another = new MyDelegate (del);

		int number = del (2, 3);

		int i = another (4, 6);
		
		Console.WriteLine ("Delegate invocation of one returned : " + number);

		Console.WriteLine ("Delegate invocation of the other returned : " + i);

		if (number == 5 && i == 10)
			return 0;
		else
			return 1;

	}

}