1 //
2 // Do not extend this test
3 //
4 // This test copes with the case where a parameter was already captured
5 // and a second anonymous method on the same scope captured a parameter
6 //
7 using System;
8 
Del(int n)9 delegate void Del (int n);
10 
11 class Lambda {
12 
13 	static int v;
14 
f(int va)15 	static void f (int va)
16 	{
17 		v = va;
18 	}
19 
Make2(int x)20 	static Del[] Make2 (int x) {
21 		return new Del[] {
22 			delegate (int a) { f(x += a); },
23 			delegate (int b) { f(x += b); }
24 		};
25 	}
26 
Main()27 	public static int Main () {
28 		Del[] d = Make2(10);
29 		d[0](10);
30 		if (v != 20)
31 			return 1;
32 
33 		d[1](11);
34 		if (v != 31)
35 			return 2;
36 		Console.WriteLine ("OK");
37 		return 0;
38 	}
39 }
40