C Sharp/Delegates

As the word suggests it delegates. It delegates the job to do an operation. In OOPS operations are called methods. So delegate is a type in c# which points to a method with a particular parameter list and return type. One can instantiate a delegate and associate it to a method/methods of similar signature and return type.

Delegates are best used as callbacks. Used to pass methods as arguments to other methods.

How to declare a delegate

    Delegates are declared with "delegate" keyword followed by return type and method signature.
    e.g: public delegate int MathOperation (int,int);