Multicast Delegate C#.NET PROGRAM

It is possible to wrap more than one method in a delegate. If you make a call to a multicast delegate it will call all the functions it wraps in the order specified.
using System;
using System.Collections.Generic;
using System.Text;
namespace delegates
{
   public delegate void TestDelegate();
    class Test
    {
        public static void Display1()
        {
            Console.WriteLine("This is the first method");
        }
        public static void Display2()
        {
            Console.WriteLine("This is the second method");
        }
        static void Main()
        {
            TestDelegate t1 = new TestDelegate(Display1);
            TestDelegate t2 = new TestDelegate(Display2);
            t1 = t1 + t2; // Make t1 a multi-cast delegate
            t1(); //Invoke delegate
            Console.ReadLine();
        }
    }
}

OUTPUT
 
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *