This error occurs because this is how behavior is defined in C # Language Specification . Any "ambiguous" use (or methods of eliminating the ambiguity of these) does not matter, although such reasoning and edge cases may have led designers to prevent explicit resolution of this differentiation .. or it could just be C # encoding for the base. NET CLI / CLR Restriction 1 .
From "3.6 Signatures and Overloading" in the C # specification (and according to related documentation), formatted as bullets:
Method signature consists of
- method name
- number of type parameters and
- type and type (value, link or output) of each of its formal parameters.
Method modifiers, including static , are not considered here as part of the method signature.
And, from the "1.6.6 Methods" we have a limitation and a consensus summary:
The signature of the method must be unique in the class in which the method is declared. A method signature consists of a method name, the number of type and quantity parameters, modifiers and types of its parameters.
This restriction applies to (and regardless of) the method considered for polymorphism.
Also, as a final note: instance methods must be virtual or accessible through an interface that must be polymorphic at run time in C #. (Both methods of hiding and overloading the method may be a form of compile-time polymorphism, but that's a different topic ..)
1 There is support for this, simply resulting from a limitation of the CLI / CLR.NET itself, which should not be bypassed (i.e. for compatibility reasons). From "I.8.6.1.5 Method Signatures" in ECMA-335 :
Method signature consists of
- calling convention [CLS Rule 15: "the only calling convention supported by CLS is the standard managed call",
- the number of common parameters, if the method is general,
- [omitted rule]
- a list of zero or more parameter signatures — one for each method parameter — and
- type signature for the value of the result, if created.
Method signatures are declared by method definitions. Only one restriction can be added to in addition to the parameter signatures [CLS Rule 15: "The vararg restriction is not part of the CLS"]:
- The vararg constraint can be included to indicate that all arguments that pass this point are optional. When it appears, the calling convention will be one that supports variable argument lists.
Thus, the intersection between the components of the C # / CLS and ECMA signature is the name of the method, the “number of common parameters” and the “list of zero or more parameter signatures”.