2010-04-06 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-anon-17.cs
bloba05dd23f3316e8a5ff0e9852f42ccb4ba8012e85
1 //
2 // Tests the syntax for delegates and events
3 //
4 using System;
6 delegate void ClickEvent ();
8 class Button {
9 public event ClickEvent Clicked;
11 public void DoClick ()
13 Clicked ();
18 class X {
19 static bool called = false;
21 static int Main ()
23 Button b = new Button ();
25 b.Clicked += delegate {
26 Console.WriteLine ("This worked!");
27 called = true;
30 b.DoClick ();
32 if (called)
33 return 0;
34 else
35 return 1;