5 sealed public class MyTest
7 sealed private class EventHandlers
9 private EventHandler _handler
= DoNothingEventHandler
;
11 public static EventHandler DoNothingEventHandler
21 public EventHandler DoSomethingEventHandler
31 public EventHandler Handler
46 EventHandlers handlers
= new EventHandlers ();
47 handlers
.Handler
= handlers
.DoSomethingEventHandler
;
49 Console
.WriteLine ("Is handlers.Handler == handlers.DoSomethingEventHandler (instance)?");
50 Console
.WriteLine ("Expected: True");
51 Console
.Write ("Actual: ");
52 bool instanceEqual
= handlers
.Handler
== handlers
.DoSomethingEventHandler
;
53 Console
.WriteLine (instanceEqual
);
56 handlers
.Handler
= EventHandlers
.DoNothingEventHandler
;
57 Console
.WriteLine ("Is handlers.Handler == EventHandlers.DoNothingEventHandler (static)?");
58 Console
.WriteLine ("Expected: True");
59 Console
.Write ("Actual: ");
60 bool staticEqual
= handlers
.Handler
== EventHandlers
.DoNothingEventHandler
;
61 Console
.WriteLine (staticEqual
);
65 return 0; // instance passed, static passed
67 return 1; // instance passed, static failed
70 return 2; // instance failed, static passed
72 return 3; // instance failed, static failed