A Description of a Delegate

Like a placeholder for a function that can be applied.
Imagine a class saying “You can use me, and then give me a method to execute”.

Below is a syntax example of this:

delegate void DoStuff( );
IDictionary<string, DoStuff> dict = new IDictionary<string, DoStuff>();
dict["foo"] = delegate { Console.Write("Hello"); };
dict["foo"]( );  // executes the delegate
// OUTPUT
Hello
Subscribe

0 comments