3 public delegate int TestDelegate1 ();
5 public interface TestItem
7 event TestDelegate1 OnUpdate
;
10 public class TestItem1
: TestItem
12 private TestDelegate1 delegates1
;
23 public virtual event TestDelegate1 OnUpdate
27 System
.Console
.WriteLine("OnUpdate add 1");
33 System
.Console
.WriteLine("OnUpdate remove 2");
40 public class TestItem2
: TestItem1
46 public override event TestDelegate1 OnUpdate
50 System
.Console
.WriteLine("OnUpdate add 2");
51 base.OnUpdate
+= value;
55 System
.Console
.WriteLine("OnUpdate remove 2");
56 base.OnUpdate
-= value;
63 public static int Main()
65 TestItem1 ti
= new TestItem2();
66 ti
.OnUpdate
+= delegate() { return 5; }
;