Answer Posted / sadab alam
Delegate is refrence type varible that holds the refrence
to a method.
There are two type of delegte
1.Sigle cast delegate
2.Multi cast delegate
if delgate variable contains refrence of one method then it
is called sinlecast delegate
and if contains refrence of more than one method then it is
called multicast refrence.
using System;
public delegate void mydel();
class del
{
public static void method1()
{
Console.WriteLine("first method");
}
public static void method2()
{
Console.WriteLine("Second method");
}
public static void Main()
{
mydel d=new mydel(method1);
d+=new mydel(method2);
d();
}
}
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
List down the commonly used types of exceptions in .net
What is uint16?
Why do we need structs in c#?
What is difference between internal and protected internal in c#?
What is difference between variable and property in c#?
What do you mean by string objects are immutable?
What is interface c#?
Define delegate?
What is the difference between add and addrange in c#?
How do destructors and garbage collection work in c#?
What does the initial catalog parameter define in the connection string?
Explain About sn.exe
How to exclude a property from xml serialization?
List down the differences between public, static and void keywords?
What is type class in c#?