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
What is verbatim string literal in c#?
Explain the constructor in c#.
If a method's return type is void, can you use a return keyword in the method?
What is xslt in c#?
What is difference between a function and a method?
How many static constructors are allowed in a class?
How long does it take to get a loop recorder put in?
What is interface c#?
Whats an assembly? Describe the importance of assembly?
What does writeline mean?
Why constructor is used in c#?
Explain About Assembly in .NET, types of assemblies, their difference, How to register into GAC. How to generate the strong names & its use.
Why do we use dataset in c#?
What are the namespace level elements?
What does immutable mean in c#?