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 Specification


17 Classes
17.5 Methods
17.5.1 Method parameters
Paragraph 11 The parameters of a method, if any, are declared by the method's formal-parameter-list. formal-parameter-list : fixed-parameters fixed-parameters , parameter-array parameter-array fixed-parameters : fixed-parameter fixed-parameters , fixed-parameter fixed-parameter : attributesopt parameter-modifieropt type identifier parameter-modifier : ref out parameter-array : attributesopt params array-type identifier
Paragraph 21 The formal parameter list consists of one or more comma-separated parameters of which only the last may be a parameter-array.
Paragraph 31 A fixed-parameter consists of an optional set of attributes (§24), an optional ref or out modifier, a type, and an identifier. 2 Each fixed-parameter declares a parameter of the given type with the given name.
Paragraph 41 A parameter-array consists of an optional set of attributes (§24), a params modifier, an array-type, and an identifier. 2 A parameter array declares a single parameter of the given array type with the given name. 3 The array-type of a parameter array must be a single-dimensional array type (§19.1). 4 In a method invocation, a parameter array permits either a single argument of the given array type to be specified, or it permits zero or more arguments of the array element type to be specified. 5 Parameter arrays are described further in §17.5.1.4.
Paragraph 51 A method declaration creates a separate declaration space for parameters and local variables. 2 Names are introduced into this declaration space by the formal parameter list of the method and by local variable declarations in the block of the method. 3 All names in the declaration space of a method must be unique. 4 Thus, it is a compile-time error for a parameter or local variable to have the same name as another parameter or local variable.
Paragraph 61 A method invocation (§14.5.5.1) creates a copy, specific to that invocation, of the formal parameters and local variables of the method, and the argument list of the invocation assigns values or variable references to the newly created formal parameters. 2 Within the block of a method, formal parameters can be referenced by their identifiers in simple-name expressions (§14.5.2).
Paragraph 71 There are four kinds of formal parameters: - 2 Value parameters, which are declared without any modifiers.
- 3 Reference parameters, which are declared with the ref modifier.
- 4 Output parameters, which are declared with the out modifier.
- 5 Parameter arrays, which are declared with the params modifier.
[Note: As described in §10.6, the ref and out modifiers are part of a method's signature, but the params modifier is not. end note] |
Jagger Software Ltd |
Company # 4070126 |
VAT # 762 5213 42 |

