Skip to content

Commit e8ae8ef

Browse files
committed
Suggestions in meeting
1 parent 7b655f6 commit e8ae8ef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

standard/classes.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -4894,7 +4894,7 @@ An instance constructor initializer cannot access the instance being created. Th
48944894
48954895
### 15.11.3 Instance variable initializers
48964896
4897-
When an instance constructor has no constructor initializer, or it has a constructor initializer of the form `base(...)`, that constructor implicitly performs the initializations specified by the *variable_initializer*s of the instance fields declared in its class. This corresponds to a sequence of assignments that are executed immediately upon entry to the constructor and before the implicit invocation of the direct base class constructor. The variable initializers are executed in the textual order in which they appear in the class declaration ([§15.5.6](classes.md#1556-variable-initializers)).
4897+
When a non-extern instance constructor has no constructor initializer, or it has a constructor initializer of the form `base(...)`, that constructor implicitly performs the initializations specified by the *variable_initializer*s of the instance fields declared in its class. This corresponds to a sequence of assignments that are executed immediately upon entry to the constructor and before the implicit invocation of the direct base class constructor. The variable initializers are executed in the textual order in which they appear in the class declaration ([§15.5.6](classes.md#1556-variable-initializers)).
48984898
48994899
Variable initializers are not required to be executed by extern instance constructors.
49004900
@@ -5117,9 +5117,12 @@ The static constructor for a closed class executes at most once in a given appli
51175117

51185118
If a class contains the `Main` method ([§7.1](basic-concepts.md#71-application-startup)) in which execution begins, the static constructor for that class executes before the `Main` method is called.
51195119

5120-
To initialize a new closed class type, first a new set of static fields ([§15.5.2](classes.md#1552-static-and-instance-fields)) for that particular closed type is created. Each of the static fields is initialized to its default value ([§15.5.5](classes.md#1555-field-initialization)). Next, the static field initializers ([§15.5.6.2](classes.md#15562-static-field-initialization)) are executed for those static fields. Finally, the static constructor is executed.
5120+
To initialize a new closed class type, first a new set of static fields (§15.5.2) for that particular closed type shall be created. Each of the static fields shall be initialized to its default value (§15.5.5). Following this:
51215121

5122-
The requirement for the static constructor to be executed *after* the static field initializers does not apply to external static constructors.
5122+
- If there is either no static constructor or a non-extern static constructor then:
5123+
- the static field initializers (§15.5.6.2) shall be executed for those static fields;
5124+
- then the non-extern static constructor, if any, shall be executed.
5125+
- Otherwise if there is an extern static constructor it shall be executed. Static variable initializers are not required to be executed by extern static constructors.
51235126

51245127
> *Example*: The example
51255128
>

0 commit comments

Comments
 (0)