3.7.C# Operators

Results are computed by building expressions. These expressions are built by combining variables and operators together into statements. The following table describes the allowable operators, their precedence, and associativity.

Operators with their precedence and Associativity
Category (by precedence) Operator(s) Associativity
Primary x.y  f(x)  a[x]  x++  x–  new  typeof  default  checked  unchecked delegate left
Unary +  –  !  ~  ++x  –x  (T)x right
Multiplicative *  /  % left
Additive +  – left
Shift <<  >> left
Relational <  >  <=  >=  is as left
Equality ==  != right
Logical AND & left
Logical XOR ^ left
Logical OR | left
Conditional AND && left
Conditional OR || left
Null Coalescing ?? left
Ternary ?: right
Assignment =  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |=  => right

Yes No Suggest edit
Suggest Edit