Merge pull request #15293 from lewing/wasm-clean
[mono-project.git] / mcs / tests / test-anon-20.cs
blobd44d779f345e0abc213470410b824504f93e71fa
1 //
2 // Nested anonymous methods tests and capturing of different variables.
3 //
4 using System;
6 delegate void D ();
8 class X {
9 static D GlobalStoreDelegate;
11 public static void Main ()
13 D d = MainHost ();
15 d ();
16 GlobalStoreDelegate ();
17 GlobalStoreDelegate ();
20 static D MainHost ()
22 int toplevel_local = 0;
24 D d = delegate () {
25 int anonymous_local = 1;
27 GlobalStoreDelegate = delegate {
28 Console.WriteLine ("var1: {0} var2: {1}", toplevel_local, anonymous_local);
29 anonymous_local = anonymous_local + 1;
32 toplevel_local = toplevel_local + 1;
35 return d;