private static void Main() { var p = new PropertyEventsSample(); p.Event1 += Delegate1Method; p.Event1 += Delegate1Method; p.Event1 -= Delegate1Method; p.RaiseEvent1(2); p.Event2 += Delegate2Method; p.Event2 += Delegate2Method; p.Event2 -= Delegate2Method; p.RaiseEvent2("TestString"); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main() { PropertyEventsSample p = new PropertyEventsSample(); p.Event1 += new EventHandler1(TestClass.Delegate1Method); p.Event1 += new EventHandler1(TestClass.Delegate1Method); p.Event1 -= new EventHandler1(TestClass.Delegate1Method); p.RaiseEvent1(2); p.Event2 += new EventHandler2(TestClass.Delegate2Method); p.Event2 += new EventHandler2(TestClass.Delegate2Method); p.Event2 -= new EventHandler2(TestClass.Delegate2Method); p.RaiseEvent2("TestString"); // Keep the console window open in debug mode. System.Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); }