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

explain query execution plan

1 Answers  


What is the difference between inner join and equi join?

0 Answers  


Explain DBMS, RDBMS?

6 Answers  


What is the security model used in sql server 2005?

0 Answers  


What are the new features in sql server 2016?

0 Answers  






If we drop a table, does it also drop related objects like constraints, indexes, columns, defaults, views, and stored procedures?

1 Answers  


What is NOT NULL Constraint in sql server 2012?

0 Answers   CDC,


How to grant a permission in ms sql server using "grant execute" statements?

0 Answers  


How can we delete Duplicate row in table?

0 Answers   Wipro,


I Have Employee table having column name as ID,SALARY how to get second max salary from employee table with id ex ID SALARY 1 20000 7 37000 2 5000

17 Answers   HCL, IBM,


How do I setup a local sql server database?

0 Answers  


What is dbcc? Give few examples.

0 Answers  


Categories