disable broken tests on net_4_0
[mcs.git] / docs / ecma334 / 8.5.xml
blobc9fdf734876c9a1d634c249cc26169846a605fd5
1 <?xml version="1.0"?>
2 <clause number="8.5" title="Expressions" informative="true">
3   <paragraph>C# includes unary operators, binary operators, and one ternary operator. The following table summarizes the operators, listing them in order of precedence from highest to lowest: <table_line>Section Category Operators </table_line>
4 <table_line>14.5 Primary x.y f(x) a[x] x++  x--new </table_line>
5 <table_line>typeof checked unchecked </table_line>
6 <table_line>0 Unary +  -! ~ ++x --x (T)x </table_line>
7 <table_line>14.7 Multiplicative * / % </table_line>
8 <table_line>14.7 Additive +  </table_line>
9 <table_line>-0 Shift &lt;&lt; &gt;&gt; </table_line>
10 <table_line>14.9 Relational and </table_line>
11 <table_line>type-testing </table_line>
12 <table_line>&lt; &gt; &lt;= &gt;= is as </table_line>
13 <table_line>14.9 Equality == != </table_line>
14 <table_line>14.10 Logical AND &amp; </table_line>
15 <table_line>14.10 Logical XOR ^ </table_line>
16 <table_line>14.10 Logical OR | </table_line>
17 <table_line>14.11 Conditional AND &amp;&amp; </table_line>
18 <table_line>14.11 Conditional OR || </table_line>
19 <table_line>14.12 Conditional ?: </table_line>
20 <table_line>14.13 Assignment = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |= </table_line>
21 When an expression contains multiple operators, the precedence of the operators controls the order in which the individual operators are evaluated. For example, the expression x + y * z is evaluated as x + (y * z) because the * operator has higher precedence than the + operator. </paragraph>
22   <paragraph>When an operand occurs between two operators with the same precedence, the associativity of the operators controls the order in which the operations are performed: <list><list_item> Except for the assignment operators, all binary operators are left-associative, meaning that operations are performed from left to right. For example, x + y + z is evaluated as (x + y) + z. </list_item><list_item> The assignment operators and the conditional operator (?:) are right-associative, meaning that operations are performed from right to left. For example, x = y = z is evaluated as x = (y = z). </list_item></list></paragraph>
23   <paragraph>Precedence and associativity can be controlled using parentheses. For example, x + y * z first multiplies y by z and then adds the result to x, but (x + y) * z first adds x and y and then multiplies the result by z. </paragraph>
24 </clause>