2009-02-10 Jeffrey Stedfast <fejj@novell.com>
[mono-project/dkf.git] / mcs / tests / test-578.cs
blob7dd5957596f9e6ac71ad940e209f72dfe4fc9bdc
1 namespace Test1
3 public delegate int TestDelegate1 ();
5 public interface TestItem
7 event TestDelegate1 OnUpdate;
10 public class TestItem1 : TestItem
12 private TestDelegate1 delegates1;
14 public TestItem1()
18 public int Test()
20 return delegates1 ();
23 public virtual event TestDelegate1 OnUpdate
25 add
27 System.Console.WriteLine("OnUpdate add 1");
29 delegates1 += value;
31 remove
33 System.Console.WriteLine("OnUpdate remove 2");
34 delegates1 -= value;
40 public class TestItem2 : TestItem1
42 public TestItem2()
46 public override event TestDelegate1 OnUpdate
48 add
50 System.Console.WriteLine("OnUpdate add 2");
51 base.OnUpdate += value;
53 remove
55 System.Console.WriteLine("OnUpdate remove 2");
56 base.OnUpdate -= value;
61 class CC
63 public static int Main()
65 TestItem1 ti = new TestItem2();
66 ti.OnUpdate += delegate() { return 5; };
67 if (ti.Test() != 5)
68 return 1;
70 return 0;