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 a callback c#?
Why do we use Design Pattern in C#?
What is string pool in c#?
Define a jagged array in c#?
How does c# generics and c++ templates compare?
Is c# a technology?
What is lazy loading c#?
Do loops c#?
What is difference between singleordefault and firstordefault?
How many types of constructors are there?
explain the nature of the assembly work?
What is as keyword in c#?
What is the use of table aliases?
How can we make a thread sleep for infinite period ?
Define using statement in c#?