Just terminology…from what I understand, delegate is type and one needs to have its instance. Thus I do not assign method to delegate but to instance of that delegate, is that right? Seems that on MSDN they are sloppy or I did not understand it well.
Just terminology…from what I understand, delegate is type and one needs to have its
Share
That’s close to right. You have an immutable delegate instance. And you can add methods which have the same signatures as the delegate type to it, which creates new delegate instances. So for example with a delegate type
Func<int>:An instance doesn’t exist yet.
Now we have an instance of it.
The old instance is gone and now we have a new one. But when you call
f()both methods will be executed. The return value will be that of the last one added to the delegate instance.