Skip to content

Commit df167bc

Browse files
authored
Cross-link sections about patterns and operators precedence (#36385)
1 parent 2c6a096 commit df167bc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/csharp/language-reference/operators/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ The following table lists the C# operators starting with the highest precedence
8888
| [c ? t : f](conditional-operator.md) | Conditional operator |
8989
| [x = y](assignment-operator.md), [x += y](arithmetic-operators.md#compound-assignment), [x -= y](arithmetic-operators.md#compound-assignment), [x *= y](arithmetic-operators.md#compound-assignment), [x /= y](arithmetic-operators.md#compound-assignment), [x %= y](arithmetic-operators.md#compound-assignment), [x &= y](boolean-logical-operators.md#compound-assignment), [x &#124;= y](boolean-logical-operators.md#compound-assignment), [x ^= y](boolean-logical-operators.md#compound-assignment), [x <<= y](bitwise-and-shift-operators.md#compound-assignment), [x >>= y](bitwise-and-shift-operators.md#compound-assignment), [x >>>= y](bitwise-and-shift-operators.md#compound-assignment), [x ??= y](null-coalescing-operator.md), [=>](lambda-operator.md) | Assignment and lambda declaration |
9090

91+
For information about the precedence of [logical pattern combinators](patterns.md#logical-patterns), see the [Precedence and order of checking of logical patterns](patterns.md#precedence-and-order-of-checking) section of the [Patterns](patterns.md) article.
92+
9193
## Operator associativity
9294

9395
When operators have the same precedence, associativity of the operators determines the order in which the operations are performed:

docs/csharp/language-reference/operators/patterns.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ As the preceding example shows, you can repeatedly use the pattern combinators i
145145

146146
### Precedence and order of checking
147147

148-
When a logical pattern is a pattern of an `is` expression, the precedence of logical pattern combinators is **higher** than the precedence of logical operators. Otherwise, the precedence of logical pattern combinators is **lower** than the precedence of logical and conditional logical operators.
149-
150-
The pattern combinators are ordered from the highest precedence to the lowest as shown in the following list:
148+
The pattern combinators are ordered from the highest precedence to the lowest as follows:
151149

152150
- `not`
153151
- `and`
154152
- `or`
155153

154+
When a logical pattern is a pattern of an `is` expression, the precedence of logical pattern combinators is **higher** than the precedence of logical operators (both [bitwise logical](bitwise-and-shift-operators.md) and [Boolean logical](boolean-logical-operators.md) operators). Otherwise, the precedence of logical pattern combinators is **lower** than the precedence of logical and conditional logical operators. For the complete list of C# operators ordered by precedence level, see the [Operator precedence](index.md#operator-precedence) section of the [C# operators](index.md) article.
155+
156156
To explicitly specify the precedence, use parentheses, as the following example shows:
157157

158158
:::code language="csharp" source="snippets/patterns/LogicalPatterns.cs" id="WithParentheses":::

0 commit comments

Comments
 (0)