[sdks] Fix README.md
[mono-project.git] / mcs / tests / test-anon-21.cs
blobcedf161bccacd6dc06ec30f05e252a986fb13d5a
1 //
2 // Nested anonymous methods and capturing of variables test
3 //
4 using System;
6 delegate void D ();
8 class X {
10 public static int Main ()
12 X x = new X();
13 x.M ();
14 e ();
15 Console.WriteLine ("J should be 101= {0}", j);
16 if (j != 101)
17 return 3;
18 Console.WriteLine ("OK");
19 return 0;
22 static int j = 0;
23 static D e;
25 void M ()
27 int l = 100;
29 D d = delegate {
30 int b;
31 b = 1;
32 Console.WriteLine ("Inside d");
33 e = delegate {
34 Console.WriteLine ("Inside e");
35 j = l + b;
36 Console.WriteLine ("j={0} l={1} b={2}", j, l, b);
39 Console.WriteLine ("Calling d");
40 d ();