Delegates
Delegate is a type which holds the method(s) reference in an object. It is also referred to as a type safe
function pointer. Delegates are roughly similar to function pointers in C++; however, delegates are type-safe and
secure. A delegate instance encapsulates a static or an instance method and calls the method for execution.
Effective use of delegate improves the performance of application. Methods can be called in 2 different ways in C#,
those are:
1. Using object of a class if it is instance and name of the class if it is static.
2. Using a delegate (either static or instance).
To use a delegate for calling a method we need to adopt the following process: