static void Main(string[] args) { Demo myob = new Demo(); MyEvent event1 = new MyEvent(); event1.SomeEvent += myob.DemoDo; event1.DoSom(); }
static void Main(string[] args) { MyEvent evt = new MyEvent(); evt.SomeEvent += delegate { Console.WriteLine("This event called."); }; evt.Fire(); }