Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ You also use the `+=` and `-=` operators to subscribe to and unsubscribe from an

## Operator precedence and associativity

The following list orders arithmetic operators from highest precedence to lowest precedence:
The following list orders arithmetic operators in groups from highest precedence to lowest precedence:

- Postfix increment `x++` and decrement `x--` operators
- Prefix increment `++x` and decrement `--x` operators, and unary `+` and `-` operators
- Multiplicative `*`, `/`, and `%` operators
- Additive `+` and `-` operators
- ([Primary](./index.md#operator-precedence)) operators: postfix increment `x++` and decrement `x--` operators.
- ([Unary](./index.md#operator-precedence)) operators: prefix increment `++x` and decrement `--x` operators, and unary `+` and `-` operators.
- ([Multiplicative](./index.md#operator-precedence)) operators: `*`, `/`, and `%` operators.
- ([Additive](./index.md#operator-precedence)) operators: binary `+` and `-` operators.

Binary arithmetic operators are left-associative. That is, the compiler evaluates operators with the same precedence level from left to right.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ Because of [numeric promotions](~/_csharpstandard/standard/expressions.md#1247-n

## Operator precedence

The following list orders bitwise and shift operators from highest precedence to lowest precedence:
The following list orders bitwise and shift operators in groups from highest precedence to lowest precedence:

- Bitwise complement operator `~`
- Shift operators `<<`, `>>`, and `>>>`
- Logical AND operator `&`
- Logical exclusive OR operator `^`
- Logical OR operator `|`
- ([Unary](./index.md#operator-precedence)) operators: Bitwise complement operator `~`.
- ([Shift](./index.md#operator-precedence)) operators: Shift operators `<<`, `>>`, and `>>>`.
- ([Bitwise logical AND](./index.md#operator-precedence)) operators: `&`.
- ([Bitwise logical XOR](./index.md#operator-precedence)) operators: Logical exclusive OR `^`.
- ([Bitwise logical OR](./index.md#operator-precedence)) operators: `|`.

Use parentheses, `()`, to change the order of evaluation from the default operator precedence:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ The `&`, `|`, and `^` operators support compound assignment, as the following ex

## Operator precedence

The following list orders logical operators starting from the highest precedence to the lowest:

- Logical negation operator `!`
- Logical AND operator `&`
- Logical exclusive OR operator `^`
- Logical OR operator `|`
- Conditional logical AND operator `&&`
- Conditional logical OR operator `||`
The following list orders logical operators in groups starting from the highest precedence to the lowest:

- ([Primary](./index.md#operator-precedence)) operators: Logical negation operator `!`.
- ([Boolean logical AND](./index.md#operator-precedence)) operators: `&`.
- ([Boolean logical XOR](./index.md#operator-precedence)) operators: Logical exclusive OR operator `^`.
- ([Boolean logical OR](./index.md#operator-precedence)) operators: `|`.
- ([Conditional AND](./index.md#operator-precedence)) operators: `&&`.
- ([Conditional OR](./index.md#operator-precedence)) operators: `||`.

Use parentheses, `()`, to change the order of evaluation imposed by operator precedence:

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/operators/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You can use an [expression body definition](../../programming-guide/statements-e

## Operator precedence

In an expression with multiple operators, the operators with higher precedence are evaluated before the operators with lower precedence. In the following example, the multiplication is performed first because it has higher precedence than addition:
In an expression with multiple operators, the operators with higher precedence are evaluated before the operators with lower precedence. Operators of the same precedence are evaluated in lexical order. In the following example, the multiplication is performed first because it has higher precedence than addition:

```csharp
var a = 2 + 2 * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ For information about the behavior of those operators for operands of other type

## Operator precedence

The following list orders pointer related operators starting from the highest precedence to the lowest:
The following list orders pointer related operators in groups starting from the highest precedence to the lowest:

- Postfix increment `x++` and decrement `x--` operators and the `->` and `[]` operators
- Prefix increment `++x` and decrement `--x` operators and the `&` and `*` operators
- Additive `+` and `-` operators
- Comparison `<`, `>`, `<=`, and `>=` operators
- Equality `==` and `!=` operators
- ([Primary](./index.md#operator-precedence)) operators: postfix increment `x++` and decrement `x--` operators and the `->` and `[]` operators.
- ([Unary](./index.md#operator-precedence)) operators: prefix increment `++x` and decrement `--x` operators and the address-of `&` and indirection `*` operators.
- ([Additive](./index.md#operator-precedence)) operators: binary `+` and `-` operators.
- ([Relational and type-testing](./index.md#operator-precedence)) operators: comparison `<`, `>`, `<=`, and `>=` operators.
- ([Equality](./index.md#operator-precedence)) operators: `==` and `!=` operators.

Use parentheses, `()`, to change the order of evaluation imposed by operator precedence.

Expand Down