C# Interview Questions on Delegates
What is a delegate? A delegate is a type safe function pointer. Using delegates you can pass methods as parameters. To pass a method as a parameter, to a delegate, the signature of the method must match the signature of the delegate. This is why, delegates are called type safe function pointers. What is the main use of delegates in C#? Delegates are mainly used to define call back methods. What do you mean by chaining delegates? Or What is a multicast delegate? The capability of calling multiple methods on a single event is called as chaining delegates. Let me give you an example to understand this further. 1. Create a new asp.net web application 2. Drag and drop a button control and leave the ID as Button1. 3. On the code behind file, add the code shown below. When you click the Button now, both Method1 and Method2 will be executed. So, this capability of calling multiple methods on a single event is called as chaining delegates. I...