Definition
Delegate is a type that references methods with a particular parameter list and return type.
Printer Custom Delegate
public delegate void Printer<T>(T data);
A Method for Printer Delegate
static void ConsoleWrite<T>(T data) {
    Console.WriteLine(data);
}
Reference the ConsoleWrite method with Printer delegate
Printer<String> consoleOut = new Printer<String>(ConsoleWrite);
consoleOut("test");
Leave a Reply