ECMA-334 C# Language Specification

10.6: Signatures and overloading

Methods, instance constructors, indexers, and operators are characterized by their signatures:

Signatures are the enabling mechanism for overloading of members in classes, structs, and interfaces:

[Example: The following example shows a set of overloaded method declarations along with their signatures.
interface ITest  
{  
   void F();              // F()  
   void F(int x);      // F(int)  
   void F(ref int x);     // F(ref int)  
   void F(out int x);     // F(out int)  
   void F(int x, int y);      // F(int, int)  
   int F(string s);      // F(string)  
   int F(int x);            // F(int)        error   
   void F(string[] a);     // F(string[])  
   void F(params string[] a);   // F(string[])   error  
}  

Note that any ref and out parameter modifiers (17.5.1) are part of a signature. Thus, F(int ), F(ref int ), and F(out int ) are all unique signatures. Also, note that the return type and the params modifier are not part of a signature, so it is not possible to overload solely based on return type or on the inclusion or exclusion of the params modifier. As such, the declarations of the methods F(int ) and F(params string[]) identified above, result in a compile-time error. end example]