2005-06-05 Peter Bartok <pbartok@novell.com>
[mono.git] / mcs / tests / 2test-a7.cs
1 //
2 // Tests capturing of variables
3 //
4 delegate void S ();
5 using System;
6
7 class X {
8         static int Main ()
9         {
10                 int a = 1;
11                 if (a != 1)
12                         return 1;
13                 
14                 Console.WriteLine ("A is = " + a);
15                 S b= delegate {
16                         Console.WriteLine ("on delegate");
17                         a = 2;
18                 };
19                 if (a != 1)
20                         return 2;
21                 b();
22                 if (a != 2)
23                         return 3;
24                 Console.WriteLine ("OK");
25                 return 0;
26         }
27 }
28