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
From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
Explain a MSIL ? Why is it appreciated by all developers?
What is the use of table aliases?
the c# keyword .int. Maps to which .net type?
What is static noise?
What is the difference between a variable and a literal?
Contrast System.String and System.Text.StringBuilder classes?
What is array and types of array in c#?
What is .cs file in c#?
Why is it called c sharp?
Can I use exceptions in c#?
What does int32 mean?
What is an assembly in dotnet?
How long can loop recorders stay in?
What is wpf application in c#?