예제 #1
0
파일: Adder.cs 프로젝트: rojac07/COM
        static void Main(string[] args)
        {
            // Create an adder.
            Adder a = new Adder();

            // Assign a method to the event.
            DoneAddingDelegate del = new DoneAddingDelegate(a.AddingComplete);
            Console.WriteLine("Delegate target: {0}", del.Target.ToString());
            Console.WriteLine("Delegate method name: {0}", del.Method.Name);

            // Trigger the event.
            Console.WriteLine("\nSum of 10 and 10 is: {0}", a.Add(10, 10));
            del.DynamicInvoke(null);
        }
예제 #2
0
파일: Adder.cs 프로젝트: summy00/COM
        static void Main(string[] args)
        {
            // Create an adder.
            Adder a = new Adder();

            // Assign a method to the event.
            DoneAddingDelegate del = new DoneAddingDelegate(a.AddingComplete);

            Console.WriteLine("Delegate target: {0}", del.Target.ToString());
            Console.WriteLine("Delegate method name: {0}", del.Method.Name);

            // Trigger the event.
            Console.WriteLine("\nSum of 10 and 10 is: {0}", a.Add(10, 10));
            del.DynamicInvoke(null);
        }