What is an example of a delegate?
Answer / Krishna Kant Sharma
A simple example of a delegate in C# is:
```
public delegate int MathOperation(int a, int b);
class Operations
{
public static int Add(int x, int y) { return x + y; }
public static int Subtract(int x, int y) { return x - y; }
}
class Program
{
static void Main()
{
MathOperation op = new MathOperation(Operations.Add);
Console.WriteLine(op(2, 3)); // Output: 5
}
}
```
| Is This Answer Correct ? | 0 Yes | 0 No |
When a new instance of a type is created, what is the type of method implicitly called?
What is the purpose of a console table?
What is Wrapper class in dot net?
List down the differences between “dispose” and “finalize” methods in c#.
What is tuple in c#?
This is Kishore i am MCA graduate i have percentage less(52%) in my 10th still i completed .NET course any body tell me how to put fake experience with my BSC degree if you do not mind tell me some fake certificates giving consultencies names in Chennai,Bangalore
Does c# support properties of array types?
What are static and dynamic variables?
Why do we parse in c#?
An abstract class is inherited, an Interface also inherited(multiple inheritance), How it differences.
Will finally block get executed if the exception had not occurred?
how to store the value in textbox using delegates if we have two user control. the value will be called from one user control to another user control. Loading and unloading will be done through delegates.
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)