Merge pull request #4928 from kumpera/ptr_to_struct_intrinsic
[mono.git] / mcs / tests / test-anon-17.cs
1 //
2 // Tests the syntax for delegates and events
3 //
4 using System;
5
6 delegate void ClickEvent ();
7
8 class Button {
9         public event ClickEvent Clicked;
10
11         public void DoClick ()
12         {
13                 Clicked ();
14         }
15         
16 }
17
18 class X {
19         static bool called = false;
20         
21         public static int Main ()
22         {
23                 Button b = new Button ();
24                                        
25                 b.Clicked += delegate {
26                         Console.WriteLine ("This worked!");
27                         called = true;
28                 };
29
30                 b.DoClick ();
31                 
32                 if (called)
33                         return 0;
34                 else
35                         return 1;
36         }
37         
38 }