Jon Jagger
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 10 Basic conceptsprevious at this levelnext at this level 10.6 Signatures and overloading Paragraph 11 Methods, instance constructors, indexers, and operators are characterized by their signatures: Paragraph 21 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]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS