What is multicast delegate...?
with ex.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ken HPosted Sep 9, 2013, 11:02 PM
The multicast delegate as a container that can store a lot of the same type.
using System;
namespace MulticastDelegate
{
delegate void SI_Deletegate();
class Person
{
private string _name;
private string _country;
public Person(string name,string country)
{
this._name = name;
this._country = country;
}
public void SelfIntroduction()
{
Console.WriteLine(_name+" is come from "+_country);
}
}
class Program
{
static void Main(string[] args)
{
Person A = new Person("Ken","Hong Kong");
Person B = new Person("Jumn","England");
Person C = new Person("Mary","India");
SI_Deletegate a = new SI_Deletegate(A.SelfIntroduction);
SI_Deletegate b = new SI_Deletegate(B.SelfIntroduction);
SI_Deletegate c = new SI_Deletegate(C.SelfIntroduction);
SI_Deletegate sid = null;
Console.WriteLine("Start self introduction...");
sid = a + b;
sid += c; // the use "+=" symbol add function
sid();
Console.WriteLine("\nAfter removal.");
sid -= c; // the use "-=" symbol Remove function
sid();
}
}
}
Jignesh TrivediPosted Sep 9, 2013, 12:50 AM
hi,
please refer following link it might help you.
http://www.c-sharpcorner.com/UploadFile/ankithakur/Delegates06042007014105AM/Delegates.aspx
http://weblogs.asp.net/jalpeshpvadgama/archive/2012/04/13/multicast-delegates-in-c.aspx
http://msdn.microsoft.com/en-us/library/system.multicastdelegate.aspx
VulpesPosted Sep 8, 2013, 1:53 PM
http://www.c-sharpcorner.com/Forums/Thread/187928/define-multicast-delegate-in-C-Sharp.aspx
Sanjeeb LenkaPosted Sep 8, 2013, 1:18 PM
Refer to this link:
http://csharp-guide.blogspot.in/2012/06/multicast-delegates-in-c.html
http://www.codeproject.com/Articles/11657/Understanding-Delegates-in-C