Add support for Windows x64 Full AOT + LLVM + Interpreter on CI. (#15276)
[mono-project.git] / mcs / tests / test-anon-19.cs
blob01e681e80b231ce8e12511b8a9fa74bf3452a23f
1 //
2 // Tests capturing of double nested variables
3 //
4 using System;
6 delegate void S ();
8 class X {
9 public static int Main ()
11 int i;
12 int a = 0;
13 S b = null;
15 for (i = 0; i < 10; i++){
16 int j = 0;
17 b = delegate {
18 Console.WriteLine ("i={0} j={1}", i, j);
19 i = i + 1;
20 j = j + 1;
21 a = j;
24 b ();
25 Console.WriteLine ("i = {0}", i);
26 if (!t (i, 11))
27 return 1;
28 b ();
29 if (!t (i, 12))
30 return 2;
31 Console.WriteLine ("i = {0}", i);
32 Console.WriteLine ("a = {0}", a);
33 if (!t (a, 2))
34 return 3;
36 return 0;
39 static bool t (int a, int b)
41 return a == b;