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


15 Statements
15.5 Declaration statements
15.5.2 Local constant declarations
Paragraph 11 A local-constant-declaration declares one or more local constants. local-constant-declaration : const type constant-declarators constant-declarators : constant-declarator constant-declarators , constant-declarator constant-declarator : identifier = constant-expression
Paragraph 21 The type of a local-constant-declaration specifies the type of the constants introduced by the declaration. 2 The type is followed by a list of constant-declarators, each of which introduces a new constant. 3 A constant-declarator consists of an identifier that names the constant, followed by an "=" token, followed by a constant-expression (§14.15) that gives the value of the constant.
Paragraph 31 The type and constant-expression of a local constant declaration must follow the same rules as those of a constant member declaration (§17.3).
Paragraph 41 The value of a local constant is obtained in an expression using a simple-name (§14.5.2).
Paragraph 51 The scope of a local constant is the block in which the declaration occurs. 2 It is an error to refer to a local constant in a textual position that precedes its constant-declarator. 3 Within the scope of a local constant, it is a compile-time error to declare another local variable or constant with the same name.
Paragraph 61 A local constant declaration that declares multiple constants is equivalent to multiple declarations of single constants with the same type. |
Jagger Software Ltd |
Company # 4070126 |
VAT # 762 5213 42 |

