Merge pull request #495 from nicolas-raoul/fix-for-issue2907-with-no-formatting-changes
[mono.git] / mcs / tests / test-anon-54.cs
1 using System;
2
3 public delegate void Hello ();
4
5 struct Foo
6 {
7         public int ID;
8
9         public Foo (int id)
10         {
11                 this.ID = id;
12         }
13
14         public void Test (Foo foo)
15         {
16                 Foo bar = this;
17                 Hello hello = delegate {
18                         foo.Hello (8);
19                         bar.Hello (3);
20                 };
21                 hello ();
22         }
23
24         public void Hello (int value)
25         {
26                 if (ID != value)
27                         throw new InvalidOperationException ();
28         }
29
30         public override string ToString ()
31         {
32                 return String.Format ("Foo ({0})", ID);
33         }
34 }
35
36 class X
37 {
38         public static void Main ()
39         {
40                 Foo foo = new Foo (3);
41                 foo.Test (new Foo (8));
42         }
43 }