0
What is delegate in C#?
A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance.-------From MSDN My understanding to delegate: It's a way of calling back a method. What confused me is: that if we can pass an object and its member methods through arguments, then why do we need the delegate? For the use of calling static method or skip constructor of calling object?
1 Odpowiedź
- 1
A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance.