Level | Category | Operators | Associativity (binary/tertiary) | 14 | Primary | x.y f(x) a[x] x++ x-- new typeof checked unchecked default delegate | left to right | 13 | Unary | + - ! ~ ++x --x (T)x true false sizeof | left to right | 12 | Multiplicative | * / % | left to right | 11 | Additive | + - | left to right | 10 | Shift | << >> | left to right | 9 | Relational and Type testing | < <= > >= is as | left to right | 8 | Equality | == != | left to right | 7 | Logical/bitwise and | & | left to right | 6 | Logical/bitwise xor | ^ | left to right | 5 | Logical/bitwise or | | | left to right | 4 | Conditional and | && | left to right | 3 | Conditional or | || | left to right | 2 | Null coalescing | ?? | left to right | 1 | Conditional | ?: | right to left | 0 | Assignment or Lambda expression | = *= /= %= += -= <<= >>= &= ^= |= => | right to left |
| | The operator priority table of C#. Operators with high level numbers have high priorities.
In a given expression, operators of high priority are evaluated before operators with lower priority.
The associativity tells if operators at the same level are evaluated from left to right or from right to left.
|