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/expressions.md
+29-5Lines changed: 29 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3007,7 +3007,7 @@ An *anonymous_method_expression* is one of two ways of defining an anonymous fun
3007
3007
3008
3008
### 11.8.1 General
3009
3009
3010
-
The `+`, `-`, `!`, `~`, `++`, `--`, cast, and `await` operatorsarecalledtheunaryoperators.
3010
+
The `+`, `-`, `!`, `~`, `^`, `++`, `--`, cast, and `await` operatorsarecalledtheunaryoperators.
3011
3011
3012
3012
```ANTLR
3013
3013
unary_expression
@@ -3016,6 +3016,7 @@ unary_expression
3016
3016
|'-'unary_expression
3017
3017
|'!'unary_expression
3018
3018
|'~'unary_expression
3019
+
|'^'unary_expression
3019
3020
|pre_increment_expression
3020
3021
|pre_decrement_expression
3021
3022
|cast_expression
@@ -3287,7 +3288,10 @@ At run-time, the expression `await t` is evaluated as follows:
3287
3288
An awaiter’s implementation of the interface methods `INotifyCompletion.OnCompleted` and `ICriticalNotifyCompletion.UnsafeOnCompleted` should cause the delegate `r` to be invoked at most once. Otherwise, the behavior of the enclosing async function is undefined.
3288
3289
3289
3290
<<<<<<< HEAD
3291
+
<<<<<<< HEAD
3292
+
=======
3290
3293
=======
3294
+
>>>>>>> 50008cc (add indexers and ranges)
3291
3295
## §range-operator Range operator
3292
3296
3293
3297
This operator provides a succinct syntax for specifying a (possibly empty) element range suitable for use in denoting a slice of an indexable sequence (§indexable-sequence).
@@ -3305,36 +3309,56 @@ For an operation of the form `s .. e`, binary operator overload resolution ([§1
The left and right operands denote, respectively, a start and end Index. For this operator, an object of (the immutable struct) type `System.Range` is returned that contains those Indexes. If the left operand is omitted, an Index of `0` is used. If the right operand is omitted, an Index of `^0` is used. As such,
3309
3314
3310
3315
-`s .. e` is transformed by the implementation to `new System.Range(s, e)`.
3311
3316
-`s ..` is transformed by the implementation to `new System.Range(s, ^0)` (or to `System.Range.StartAt(s)` if that method exists, is accessible, and is declared as follows: `public static Range StartAt (Index start);`).
3312
3317
-`.. e` is transformed by the implementation to `new System.Range(0, e)` (or to `System.Range.EndAt(e)` if that method exists, is accessible, and is declared as follows: `public static Range EndAt (Index end);`).
3313
3318
-`..` is transformed by the implementation to `new System.Range(0, ^0)` (or instead to `System.Range.All` if that property exists, is accessible, and is declared as follows: `public static Range All { get; }`).
3319
+
=======
3320
+
The left and right operands denote, respectively, a start and end Index. For this operator, an object of (the immutable struct) type `System.Range` is returned that contains those Indexes. If the left operand is omitted, an Index of `0` is used. If the right operand is omitted, an Index of `^0` is used. As such,
3321
+
-`s .. e` is transformed by the implementation to `new System.Range(s, e)`.
3322
+
-`s ..` is transformed by the implementation to `new System.Range(s, ^0)` (or to ` System.Range.StartAt(s)` if that method exists, is accessible, and is declared as follows: `public static Range StartAt (Index start);`).
3323
+
-`.. e` is transformed by the implementation to `new System.Range(0, e)` (or to ` System.Range.EndAt(e)` if that method exists, is accessible, and is declared as follows: `public static Range EndAt (Index end);`).
3324
+
-`..` is transformed by the implementation to `new System.Range(0, ^0)` (or instead to ` System.Range.All` if that property exists, is accessible, and is declared as follows: `public static Range All { get; }`).
3325
+
>>>>>>> 50008cc (add indexers and ranges)
3314
3326
3315
3327
> *Note*: While a Range can be created with a start Index greater than the end Index, any attempt to use that Range to denote a slice from an indexable sequence will result in `System.ArgumentOutOfRangeException`. *end note*
3316
3328
3317
3329
Lifted ([§11.4.8](expressions.md#1148-lifted-operators)) forms of the unlifted predefined range operator defined above are also predefined.
3318
3330
3319
3331
> *Example*: The following example uses array and string indexable sequences:
0 commit comments