Delegates
A delegate is a type that references a method means it holds the address of method. It allows encapsulating a reference to a method inside a delegate object. A delegate can be assigned a method after which it can be used like any other method. You must define the delegate to match the signature of the method it will point to.
Delegates Overview
· Delegates are similar to C++ function pointers, but are type safe, object-oriented and secure.
· Delegates hold the address of one function or addresses of many functions.
· Delegates encapsulate some information like class names and methods names.
· If a Delegate is holding the address of only one function then it is called as single cast Delegate.
· If a Delegate is holding the addresses of many functions then it is called as Multicast Delegate.
· C# version 2.0 introduces the concept of Anonymous Methods, which permit code blocks to be passed as parameters in place of a separately defined method.
· Delegates can be used to invoke methods Asynchronously.