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 the name of c# compiler?
What is the purpose of a constructor in c#?
What is the file extension for c#?
Can partial class be inherited?
What is equal c#?
How do you serialize an object?
Can you declare a field readonly?
What is arraylist?
Which compiler switch creates an xml file from xml comments in the files in an assembly?
What does void do in c#?
What do you mean by abstract class in c#?
What are instance fields in c#?
What can I create with c#?
What is default boolean value in c#?
What is inner class in c#?