Methods, instance constructors, indexers, and operators are characterized by their signatures:
A Method signature consists of the method name and the type and type (value, reference, or output) of each of its parameters (in the order from left to right. Note that the method signature does not contain either the return type or the Params modifier (which can be used for rightmost parameters ).
The instance constructor signature is composed of the type and type (value, reference, or output) of each of its parameters (in the order from left to right. Specifically, the instance constructor signature does not contain the Params modifier that can be specified for the rightmost parameter.
The index signature is composed of each of its parameters (in the order from left to right. Specifically, the index signature does not contain the element type.
The operator signature is composed of the Operator name and each of its parameters (in the order from left to right. Specifically, the signature of an operator does not contain the result type.
Signature is a mechanism to overload members of classes, structures, and interfaces:
Method overloading allows classes, structures, or interfaces to declare multiple methods with the same name, provided that their signatures are unique in the class, structure, or interface.
An instance constructor overload allows a class or structure to declare multiple instance constructor, provided that their signatures are unique in this class or structure.
The indexer overload allows the class, structure, or interface to declare multiple indexers. The condition is that their signatures are unique in the class, structure, or interface.
Operator Overloading allows classes or structures to declare multiple operators with the same name. The condition is that their signatures are unique in this class or structure.
The following example shows a set of overloaded method declarations and their signatures.
Interface itest
{
Void F (); // F ()
Void F (int x); // F (INT)
Void F (ref int X); // F (ref 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 all ref and out parameter modifiers (section 10.5.1) are part of the signature. Therefore, both the F (INT) and F (ref INT) signatures are unique. Note that the return type and Params modifier are not part of the signature, so it is not possible to implement overloading only based on the return type or whether the Params modifier exists. Therefore, the declarations on Methods F (INT) and F (Params string []) listed above will cause compilation errors.