Delegate
Delegate is a type
which holds the method(s) reference in an object. It is also referred to
as a type safe function pointer. Basically a delegate dynamically wires up a method caller to
its target method.
A delegate type declaration is preceded by the keyword delegate
delegate
int Transformer (int x);
To create a delegate instance, you can assign a method to a
delegate variable:
class Test
{
static void Main()
{
Transformer t = Square; // Create delegate instance
int result = t(3); // Invoke delegate
Console.WriteLine (result); // 9
}
static int Square (int x) { return x * x; }
}
Event
An event is a
construct that exposes just the subset of delegate features required for the
broadcaster/subscriber model. The main purpose of events is to prevent
subscribers from interfering with each other. The broadcaster is a type that
contains a delegate field. The subscribers are the method target recipients
public class Broadcaster
{
public event
ProgressReporter Progress;
}

