I was thinking on MulticastDelegate and Delegate, and i dont understand why the reason that invoke method arent an abstract method of MulticastDelegate. Someone knows?
-
Why do yo think it should be an abstract method? – Tim Sep 13 '15 at 23:22
-
Because all the delegates implements the same invoke, so i can override the invoke method for my delegate... – StevenS Sep 13 '15 at 23:25
-
No, the Invoke() method for every delegate is different. Auto-generated by the compiler from the delegate declaration, it has the same arguments. So you can never call it wrong. And it can't be abstract. – Hans Passant Sep 14 '15 at 17:08
1 Answers
The MulticastDelegate
type has no Invoke()
method (nor BeginInvoke()
). These methods are automatically provided in the actual delegate
type by the runtime. So the most obvious reason to the question "why isn't the Invoke()
method in MulticlassDelegate
marked abstract
" is that there is no such method.
If you are asking why that method is not in MulticlassDelegate
(and then marked abstract
there), then I would ask you: how could it be? Each delegate type needs its own Invoke()
method, because the signature of that method depends specifically on the signature of the delegate type. No base class could provide that type.
Finally, note that the MulticlassDelegate
type is one of several "special" types in .NET, and is explicitly intended not to be inherited by user code. Not it, nor any declared delegate
subclass of the type. Since inheritance is not possible, it really doesn't matter whether a member is abstract
; it wouldn't do anyone any good even if it were.
From the documentation:
The Delegate class is the base class for delegate types. However, only the system and compilers can derive explicitly from the Delegate class or from the MulticastDelegate class. It is also not permissible to derive a new type from a delegate type. The Delegate class is not considered a delegate type; it is a class used to derive delegate types.
Most languages implement a delegate keyword, and compilers for those languages are able to derive from the MulticastDelegate class; therefore, users should use the delegate keyword provided by the language.
- Note:
The common language runtime provides an Invoke method for each delegate type, with the same signature as the delegate. You do not have to call this method explicitly from C#, Visual Basic, or Visual C++, because the compilers call it automatically. The Invoke method is useful in reflection when you want to find the signature of the delegate type.

- 1
- 1

- 68,759
- 7
- 102
- 136