A Operator Precedence Chart

Operators are shown in decreasing order of precedence from top to bottom with each level of precedence separated by a horizontal line. The associativity of the operators is shown in the right column.

Fig. A.1 Operator precedence chart

Operator Type Associativity
. member access left-to-right
?. null-conditional member access  
() method call  
[] element access  
?[] null-conditional element access  
++ postfix increment  
-- postfix decrement  
nameof string representation of an identifier  
new object creation  
typeof get System.Type object for a type  
sizeof get size in bytes of a type  
checked checked evaluation  
unchecked unchecked evaluation  
+ unary plus right-to-left
- unary minus  
! logical negation  
~ bitwise complement  
++ prefix increment  
-- prefix decrement  
(type) cast  
* multiplication left-to-right
/ division  
% remainder  
+ addition left-to-right
- subtraction  
>> right shift left-to-right
<< left shift  
< less than left-to-right
> greater than  
<= less than or equal to  
>= greater than or equal to  
is type comparison  
as type conversion  
!= is not equal to left-to-right
== is equal to  
& logical AND left-to-right
^ logical XOR left-to-right
| logical OR left-to-right
&& conditional AND left-to-right
|| conditional OR left-to-right
?? null coalescing right-to-left
?: conditional right-to-left
= assignment right-to-left  
*= multiplication assignment  
/= division assignment  
%= remainder assignment  
+= addition assignment  
-= subtraction assignment  
<<= left shift assignment  
>>= right shift assignment  
&= logical AND assignment  
^= logical XOR assignment  
|= logical OR assignment  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset