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

What is the need for group functions in sql?

0 Answers  


How to test odbc dsn connection settings?

0 Answers  


Can truncate be rolled back?

0 Answers  


How to find the date and time of last updated table?

3 Answers  


What is difference between views and tables?

0 Answers  


what are the limitations of parameters in a storedprocedure

1 Answers  


What is the primary use of the model database?

0 Answers  


What is the sql case statement used for?

0 Answers  


What is “asynchronous” communication in sql server service broker?

0 Answers  


Can we rollback records deleted by a truncate statement?

3 Answers   CarrizalSoft Technologies, United Healthcare,


Explain various On-Delete options in a DB table. Which is the default option?

0 Answers   Akamai Technologies,


How to get @@error and @@rowcount at the same time?

0 Answers  


Categories