what are delegates? How you used then in your project?
Answer Posted / prashanth
Delegate means function pointer.
There are two types of delegate
1-simple delegate
2-multicast delegate.
for simple ex:
private void Page_Load(object sender, System.EventArgs e)
{
Label2.Text= DoAction(new Action(Add)).ToString();
Response.Write ("<BR>");
Label3.Text= DoAction(new Action(Sub)).ToString();
//
// // Put user code to initialize the page here
}
static int DoAction(Action action)
{
return action(5,2);
}
public int Add(int n,int m)
{
return n+m;
}
public int Sub(int n,int m)
{
return n-m;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between finalize() and dispose() methods?
What is a class in unity?
Can c# inherit multiple classes?
What is desktop application testing?
Can a class have more than 1 destructor?
What is the syntax for calling an overloaded constructor within a constructor?
How does inheritance work in c#?
How many constructor can a class have?
What's new in c#?
Is comparable a functional interface?
What is namespace explain with example?
Can an abstract class have a constructor c#?
There were a lot of questions asked, so I will list the topic (and add a what is "topic" and know pros/cons). Extreme programming, what is a transaction, various SDLC design approaches, what is a namespace, define a good test case, what is a stored proc, webservice? design patterns? linker? compiler? access modifiers? stack vs. queue? arrays vs. linked lists? sorting algorithms? recursion? OOP principles?
What is the difference between ref and out parameters in c#?
What are the steps for creating clr trigger