Thursday, 5 September 2013

Multicasting in Delegate



Multicast Delegates :
    Delegate multicast is that we can point more than one function at a time. A multicast delegate maintains a list of functions that will all be called when the delegate is invoked

    public class MyClassName
    {
        public delegate void delgName();
        public void main()
        {
            delgName dgt = new delgName(main1);
            dgt += new delgName(main2);
            dgt();
        }
        public void main1()
        {
        /// this will called first
        }
        public void main2()
        {
        /// this will called secondly
        }
    }

No comments:

Post a comment