Interview answers verified by specialists.

Find interview questions and answers on this website:


See right interview answers on 30 common job interview questions

Explain how to implement Delegates in C#.NET

Here is an implementation of a very simple delegate that accepts no parameters.

public delegate void MyDelegate();// Declaration
class MyClass
{
public static void MyFunc()
{
Console.WriteLine("MyFunc Called from a Delegate");
}
public static void Main()
{
MyDelegate myDel = new MyDelegate(MyFunc);
myDel();
}
}