LM Tech's blog

Software Architecture & Design Patterns


The delegate is a reference type that can be used to encapsulate a method with a specific signature. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure.

The delegate is declared using the keyword delegate: More...

A callback is a reference to a portion of executable code, that is passed as an argument to other code.
Using callback, for instance, a server program can notify to a caller when the requested operation ends. The callback paradigm can also be used instead of the Observer Design Pattern. In Microsoft .Net Framework, callbacks are implemented using delegates that provides type-safe function pointer.

A delegate is declared using the delegate key-word:

public delegate void OperationCallbackDelegate(int value);