In this code snippet, we will take a look at delagates in C#.
A delegate is a pointer to a method(basically an indirect call to the method). Delegates can be passed as input parameters to other methods. A benefit of this is that it provides flexibility. Such a method can then use the passed in delegate to call another method(callback method). This is actually the way events work in .NET.
Let’s have a look at the code below to see how to use delegates.