linux-packaging-mono/mcs/tests/test-anon-06.cs

30 lines
374 B
C#
Raw Normal View History

//
// Tests capturing of variables
//
using System;
delegate void S ();
class X {
public static int Main ()
{
int a = 1;
if (a != 1)
return 1;
Console.WriteLine ("A is = " + a);
S b= delegate {
Console.WriteLine ("on delegate");
a = 2;
};
if (a != 1)
return 2;
b();
if (a != 2)
return 3;
Console.WriteLine ("OK");
return 0;
}
}