예제 #1
0
파일: Events.cs 프로젝트: nkuneng/samples
        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();
        }
예제 #2
0
        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();
        }