MULTICAST DELEGATES IN C#.NET WITH REAL TIME EXAMPLE

Answers were Sorted based on User's Feedback



MULTICAST DELEGATES IN C#.NET WITH REAL TIME EXAMPLE..

Answer / guest

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

MULTICAST DELEGATES IN C#.NET WITH REAL TIME EXAMPLE..

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

Post New Answer

More SQL Server Interview Questions

default databases available in sql server and there uses ?

4 Answers   TCS,


How to access the deleted record of an event?

0 Answers  


What is RAID and what are different types of RAID configurations?

8 Answers   Wipro,


Can anyone explain difference between Database, Data warehouse and Data mart with some example?````

4 Answers  


How to insert a new row into a table with "insert into" statements in ms sql server?

0 Answers  


how to copy only distinct data into another table which is not already exist in database?

2 Answers   Spectra,


What is SQL server agent?

2 Answers   HCL, SAP Labs,


What is row_number () and partition by in sql server?

0 Answers  


How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?

0 Answers  


What is the sql server agent?

0 Answers  


Explain about link server in sql server?

0 Answers  


Explain active/passive and active/active cluster configurations?

0 Answers  


Categories