add ISafeSerializationData
[mcs.git] / tests / test-anon-82.cs
blob94807c63784d7459f908b1ba6c4dfa0b49c4074a
1 //
2 // Tests different anonymous method caching scenarios
3 //
5 public delegate void StringSender (string str);
6 public delegate void VoidDelegate ();
8 public class MainClass
10 public static void Main()
12 MainClass mc = new MainClass ();
13 VoidDelegate del = new VoidDelegate (
14 delegate {
15 StringSender ss = delegate (string s) {
16 SimpleCallback(mc, s);
18 ss("Yo!");
21 del();
23 mc.Test2 (10);
24 mc.Test3 (20);
25 mc.Test4 ();
26 mc.Test5 (50);
29 void Test2 (int a)
31 StringSender d = delegate (string s) {
32 VoidDelegate d2 = delegate {
33 s = "10";
38 void Test3 (int a)
40 int u = 8;
41 VoidDelegate d = delegate () { u = 9; };
42 VoidDelegate d2 = delegate () { };
45 void Test4 ()
47 VoidDelegate d = delegate () {
48 VoidDelegate d2 = delegate () {
49 int a = 9;
50 VoidDelegate d3 = delegate () {
51 VoidDelegate d4 = delegate () {
52 a = 3;
59 int a;
60 int b;
62 delegate int D (int a);
64 void Test5 (int arg)
66 D d2 = delegate (int i) {
67 D d1 = delegate (int a) {
68 return a;
71 return d1 (9) + arg;
75 static void SimpleCallback (MainClass mc, string str)
77 System.Console.WriteLine(str);