You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/basic-concepts.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -970,15 +970,15 @@ The behavior of the garbage collector can be controlled, to some degree, via sta
970
970
>createsaninstanceof class `A` and an instance of class `B`. These objects become eligible for garbage collection when the variable `b` is assigned the value `null`, since after this time it is impossible for any user-written code to access them. The output could be either
971
971
>
972
972
> ```console
973
-
> Finalize instance of `A`
974
-
> Finalize instance of `B`
973
+
> Finalize instance of A
974
+
> Finalize instance of B
975
975
> ```
976
976
>
977
977
> or
978
978
>
979
979
> ```console
980
-
> Finalize instance of `B`
981
-
> Finalize instance of `A`
980
+
> Finalize instance of B
981
+
> Finalize instance of A
982
982
> ```
983
983
>
984
984
> because the language imposes no constraints on the order in which objects are garbage collected.
>*Example*:Referringtotheexampleabove, if `A` and `B` weredeclaredinseparateprograms, itwouldbepossiblefor `A.X` to depend on `B.Z`, but `B.Z` could then not simultaneously depend on `A.Y`.
1434
-
>
1435
-
> *end example*
1433
+
>*Example*:Referringtotheexampleabove, if `A` and `B` weredeclaredinseparateprograms, itwouldbepossiblefor `A.X` to depend on `B.Z`, but `B.Z` could then not simultaneously depend on `A.Y`. *end example*
1436
1434
1437
1435
## 14.5 Fields
1438
1436
@@ -2179,9 +2177,7 @@ Output parameters are typically used in methods that produce multiple return val
>*Example*:Givenan*enum_type* `E` withandunderlyingtypeof `int`, aconversionfrom `E` to `byte` isprocessedasanexplicitnumericconversion ([§10.3.2](conversions.md#1032-explicit-numeric-conversions)) from `int` to `byte`, andaconversionfrom `byte` to `E` isprocessedasanimplicitnumericconversion ([§10.2.3](conversions.md#1023-implicit-numeric-conversions)) from `byte` to `int`.
377
-
>
378
-
>*endexample*
376
+
>*Example*:Givenan*enum_type* `E` withandunderlyingtypeof `int`, aconversionfrom `E` to `byte` isprocessedasanexplicitnumericconversion ([§10.3.2](conversions.md#1032-explicit-numeric-conversions)) from `int` to `byte`, andaconversionfrom `byte` to `E` isprocessedasanimplicitnumericconversion ([§10.2.3](conversions.md#1023-implicit-numeric-conversions)) from `byte` to `int`. *endexample*
379
377
380
378
### 10.3.4 Explicit nullable conversions
381
379
@@ -887,6 +885,7 @@ The compile-time application of the conversion from a method group `E` to a del
Copy file name to clipboardExpand all lines: standard/expressions.md
+9-27Lines changed: 9 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2313,9 +2313,7 @@ array_creation_expression
2313
2313
2314
2314
An array creation expression of the first form allocates an array instance of the type that results from deleting each of the individual expressions from the expression list.
2315
2315
2316
-
> *Example*: The array creation expression `new int[10,20]` produces an array instance of type `int[,]`, and the array creation expression new `int[10][,]` produces an array instance of type `int[][,]`.
2317
-
>
2318
-
> *end example*
2316
+
> *Example*: The array creation expression `new int[10,20]` produces an array instance of type `int[,]`, and the array creation expression new `int[10][,]` produces an array instance of type `int[][,]`. *end example*
2319
2317
2320
2318
Each expression in the expression list shall be of type `int`, `uint`, `long`, or `ulong`, or implicitly convertible to one or more of these types. The value of each expression determines the length of the corresponding dimension in the newly allocated array instance. Since the length of an array dimension shall be nonnegative, it is a compile-time error to have a constant expression with a negative value, in the expression list.
2321
2319
@@ -3079,9 +3077,7 @@ A *cast_expression* of the form `(T)E`, where `T` is a type and `E` is a *unary_
3079
3077
3080
3078
The grammar for a *cast_expression* leads to certain syntactic ambiguities.
3081
3079
3082
-
> *Example*: The expression `(x)–y` could either be interpreted as a *cast_expression* (a cast of `–y` to type `x`) or as an *additive_expression* combined with a *parenthesized_expression* (which computes the value `x – y`).
3083
-
>
3084
-
> *end example*
3080
+
> *Example*: The expression `(x)–y` could either be interpreted as a *cast_expression* (a cast of `–y` to type `x`) or as an *additive_expression* combined with a *parenthesized_expression* (which computes the value `x – y`). *end example*
3085
3081
3086
3082
To resolve *cast_expression* ambiguities, the following rule exists: A sequence of one or more tokens ([§6.4](lexical-structure.md#64-tokens)) enclosed in parentheses is considered the start of a *cast_expression* only if at least one of the following are true:
3087
3083
@@ -3090,9 +3086,7 @@ To resolve *cast_expression* ambiguities, the following rule exists: A sequence
3090
3086
3091
3087
The term “correct grammar” above means only that the sequence of tokens shall conform to the particular grammatical production. It specifically does not consider the actual meaning of any constituent identifiers.
3092
3088
3093
-
> *Example*: If `x` and `y` are identifiers, then `x.y` is correct grammar for a type, even if `x.y` doesn’t actually denote a type.
3094
-
>
3095
-
> *end example*
3089
+
> *Example*: If `x` and `y` are identifiers, then `x.y` is correct grammar for a type, even if `x.y` doesn’t actually denote a type. *end example*
3096
3090
<!-- markdownlint-disable MD028 -->
3097
3091
3098
3092
<!-- markdownlint-enable MD028 -->
@@ -3978,9 +3972,7 @@ Shift operations never cause overflows and produce the same results in checked a
3978
3972
3979
3973
When the left operand of the `>>` operator is of a signed integral type, the operator performs an *arithmetic* shift right wherein the value of the most significant bit (the sign bit) of the operand is propagated to the high-order empty bit positions. When the left operand of the `>>` operator is of an unsigned integral type, the operator performs a *logical* shift right wherein high-order empty bit positions are always set to zero. To perform the opposite operation of that inferred from the operand type, explicit casts can be used.
3980
3974
3981
-
> *Example*: If `x` is a variable of type `int`, the operation `unchecked ((int)((uint)x >> y))` performs a logical shift right of `x`.
3982
-
>
3983
-
> *end example*
3975
+
> *Example*: If `x` is a variable of type `int`, the operation `unchecked ((int)((uint)x >> y))` performs a logical shift right of `x`. *end example*
3984
3976
3985
3977
Lifted ([§11.4.8](expressions.md#1148-lifted-operators)) forms of the unlifted predefined shift operators defined above are also predefined.
3986
3978
@@ -4095,9 +4087,7 @@ The operators compare the operands according to the rules of the IEC 60559 stand
4095
4087
4096
4088
If either operand is NaN, the result is `false` for all operators except `!=`, for which the result is `true`. For any two operands, `x != y` always produces the same result as `!(x == y)`. However, when one or both operands are NaN, the `<`, `>`, `<=`, and `>=` operators do *not* produce the same results as the logical negation of the opposite operator.
4097
4089
4098
-
> *Example*: If either of `x` and `y` is NaN, then `x` < `y` is `false`, but `!(x >= y)` is `true`.
4099
-
>
4100
-
> *end example*
4090
+
> *Example*: If either of `x` and `y` is NaN, then `x` < `y` is `false`, but `!(x >= y)` is `true`. *end example*
4101
4091
4102
4092
When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering
4103
4093
@@ -4601,9 +4591,7 @@ In a null coalescing expression of the form `a ?? b`, if `a` is non-`null`, th
4601
4591
4602
4592
The null coalescing operator is right-associative, meaning that operations are grouped from right to left.
4603
4593
4604
-
> *Example*: An expression of the form `a ?? b ?? c` is evaluated as a `?? (b ?? c)`. In general terms, an expression of the form `E1 ?? E2 ?? ... ?? EN` returns the first of the operands that is non-`null`, or `null` if all operands are `null`.
4605
-
>
4606
-
> *end example*
4594
+
> *Example*: An expression of the form `a ?? b ?? c` is evaluated as a `?? (b ?? c)`. In general terms, an expression of the form `E1 ?? E2 ?? ... ?? EN` returns the first of the operands that is non-`null`, or `null` if all operands are `null`. *end example*
4607
4595
4608
4596
The type of the expression `a ?? b` depends on which implicit conversions are available on the operands. In order of preference, the type of `a ?? b` is `A₀`, `A`, or `B`, where `A` is the type of `a` (provided that `a` has a type), `B` is the type of `b`(provided that `b` has a type), and `A₀` is the underlying type of `A` if `A` is a nullable value type, or `A` otherwise. Specifically, `a ?? b` is processed as follows:
4609
4597
@@ -4631,9 +4619,7 @@ A conditional expression of the form `b ? x : y` first evaluates the conditi
4631
4619
4632
4620
The conditional operator is right-associative, meaning that operations are grouped from right to left.
4633
4621
4634
-
> *Example*: An expression of the form `a ? b : c ? d : e` is evaluated as `a ? b : (c ? d : e)`.
4635
-
>
4636
-
> *end example*
4622
+
> *Example*: An expression of the form `a ? b : c ? d : e` is evaluated as `a ? b : (c ? d : e)`. *end example*
4637
4623
4638
4624
The first operand of the `?:` operator shall be an expression that can be implicitly converted to `bool`, or an expression of a type that implements `operator true`. If neither of these requirements is satisfied, a compile-time error occurs.
4639
4625
@@ -6055,9 +6041,7 @@ The `+=` and `-=` operators with an event access expression as the left operand
@@ -6193,9 +6177,7 @@ An operation of the form `x «op»= y` is processed by applying binary operato
6193
6177
6194
6178
Theterm “evaluatedonlyonce” meansthatintheevaluationof `x «op» y`, theresultsofanyconstituentexpressionsof `x` aretemporarilysavedandthenreused when performing the assignment to `x`.
6195
6179
6196
-
>*Example*: Intheassignment `A()[B()] += C()`, where `A` isamethodreturning `int[]`, and `B` and `C` aremethodsreturning `int`, themethodsareinvokedonlyonce, intheorder `A`, `B`, `C`.
6197
-
>
6198
-
> *endexample*
6180
+
>*Example*: Intheassignment `A()[B()] += C()`, where `A` isamethodreturning `int[]`, and `B` and `C` aremethodsreturning `int`, themethodsareinvokedonlyonce, intheorder `A`, `B`, `C`. *endexample*
Copy file name to clipboardExpand all lines: standard/general-description.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Examples are provided to illustrate possible forms of the constructions describe
13
13
Informative text is indicated in the following ways:
14
14
15
15
1. Whole or partial clauses or annexes delimited by “**This clause/text is informative**” and “**End of informative text**”.
16
-
1.*Example*: The following example … code fragment, possibly with some narrative … *end example*
17
-
1.*Note*: narrative … *end note* The *Note*: and *end note* are in the same paragraph for single paragraph notes. If a note spans multiple paragraphs, the *end note* marker should be its own paragraph.
16
+
1.*Example*: The following example … code fragment, possibly with some narrative … *end example* The *Example:* and *end example* markers are in the same paragraph for single paragraph examples. If an example spans multiple paragraphs, the end example marker should be its own paragraph.
17
+
1.*Note*: narrative … *end note* The *Note*: and *end note*markers are in the same paragraph for single paragraph notes. If a note spans multiple paragraphs, the *end note* marker should be its own paragraph.
18
18
19
19
All text not marked as being informative is normative.
Copy file name to clipboardExpand all lines: standard/lexical-structure.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,9 +155,7 @@ The lexical processing of a C# compilation unit consists of reducing the file i
155
155
156
156
When several lexical grammar productions match a sequence of characters in a compilation unit, the lexical processing always forms the longest possible lexical element.
157
157
158
-
> *Example*: The character sequence `//` is processed as the beginning of a single-line comment because that lexical element is longer than a single `/` token.
159
-
>
160
-
> *end example*
158
+
> *Example*: The character sequence `//` is processed as the beginning of a single-line comment because that lexical element is longer than a single `/` token. *end example*
161
159
162
160
Some tokens are defined by a set of lexical rules; a main rule and one or more sub-rules. The latter are marked in the grammar by `fragment` to indicate the rule defines part of another token. Fragment rules are not considered in the top-to-bottom ordering of lexical rules.
163
161
@@ -914,7 +912,7 @@ right_shift_assignment
914
912
915
913
*right_shift* is made up of the two tokens `>` and `>`. Similarly, *right_shift_assignment* is made up of the two tokens `>` and `>=`. Unlike other productions in the syntactic grammar, no characters of any kind (not even whitespace) are allowed between the two tokens in each of these productions. These productions are treated specially in order to enable the correct handling of *type_parameter_lists* ([§14.2.3](classes.md#1423-type-parameters)).
916
914
917
-
> *Note*: Prior to the addition of generics to C#, `>>` and `>>=` were both single tokens. However, the syntax for generics uses the `<` and `>` characters to delimit type parameters and type arguments. It is often desirable to use nested constructed types, such as `List<Dictionary<string, int>>`. Rather than requiring the programmer to separate the `>` and `>` by a space, the definition of the two *operator_or_punctuator*s was changed.
915
+
> *Note*: Prior to the addition of generics to C#, `>>` and `>>=` were both single tokens. However, the syntax for generics uses the `<` and `>` characters to delimit type parameters and type arguments. It is often desirable to use nested constructed types, such as `List<Dictionary<string, int>>`. Rather than requiring the programmer to separate the `>` and `>` by a space, the definition of the two *operator_or_punctuator*s was changed.*end note*
Copy file name to clipboardExpand all lines: standard/structs.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,8 @@ A variable of a struct type directly contains the data of the struct, whereas a
143
143
> ```
144
144
>
145
145
>isanerrorbecauseeachofthetypes `A`, `B`, and `C` dependoneachother.
146
-
*endexample*
146
+
>
147
+
>*endexample*
147
148
148
149
Withclasses, itispossiblefortwovariablestoreferencethesameobject, andthuspossiblefor operations on one variable to affect the object referenced by the other variable. With structs, the variables each have their own copy of the data (except in the case of `ref` and `out` parametervariables), anditisnotpossibleforoperationsononetoaffecttheother. Furthermore, exceptwhenexplicitlynullable ([§8.3.11](types.md#8311-nullable-value-types)), itisnotpossibleforvaluesofastructtypetobe `null`.
0 commit comments