MULTICAST DELEGATES IN C#.NET WITH REAL TIME EXAMPLE
Answers were Sorted based on User's Feedback
delegates used to invoke one function. Multicasst delegate
is used to invoke mmore than one function
Say for example
This is our delegate
delegate void myDelegate (string s);
Weh ve two functions like
publc void sayHello(String Name)
{
//implementation goes here
}
public void sayHai(String Name)
{
//implementation goes here
}
If we want to invoke both of these functions
use like
myDelegate md= new myDelegate(sayHello);
md+=new myDelegate(sayHai);
Is This Answer Correct ? | 33 Yes | 4 No |
Answer / lince thomas
delegate void myDelegate(string s);//this is a delagate
//two functions below.
private void SayHello(string h)
{
MessageBox.Show("Hello" + h);
}
private void SayHai(string h)
{
MessageBox.Show("Hai" + h);
}
private void button1_Click(object sender, EventArgs e)
{
Delegate del;
myDelegate objDel = new myDelegate(SayHello);
myDelegate objDel1 = new myDelegate(SayHai);
del = MulticastDelegate.Combine(objDel, objDel1);
del.DynamicInvoke("Peter");
}
Is This Answer Correct ? | 17 Yes | 1 No |
default databases available in sql server and there uses ?
How to access the deleted record of an event?
What is RAID and what are different types of RAID configurations?
Can anyone explain difference between Database, Data warehouse and Data mart with some example?````
How to insert a new row into a table with "insert into" statements in ms sql server?
how to copy only distinct data into another table which is not already exist in database?
What is SQL server agent?
What is row_number () and partition by in sql server?
How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?
What is the sql server agent?
Explain about link server in sql server?
Explain active/passive and active/active cluster configurations?