Table 4-2 shows the order of precedence for all C# operators, from highest to lowest. This table includes several operators that will be discussed later in this book.
Highest | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
() | [] | · | ++ (postfix) | −− (postfix) | checked | new | sizeof | typeof | unchecked | ∷ |
! | ~ | (cast) | + (unary) | − (unary) | ++ (prefix) | −− (prefix) | ||||
* | / | % | ||||||||
+ | − | |||||||||
« | » | |||||||||
< | > | <= | >= | is | as | |||||
== | != | |||||||||
& | ||||||||||
^ | ||||||||||
| | ||||||||||
&& | ||||||||||
|| | ||||||||||
?: | ||||||||||
= | op= | |||||||||
Lowest |