Example #1
0
File: Adder.cs Project: 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);
        }
Example #2
0
File: Adder.cs Project: 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);
        }