Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specification


14 Expressions
14.2 Operators
Paragraph 11 Expressions are constructed from operands and operators. 2 The operators of an expression indicate which operations to apply to the operands. 3 Examples of operators include +, -, *, /, and new. 4 Examples of operands include literals, fields, local variables, and expressions.
Paragraph 21 There are three kinds of operators: - 2 Unary operators. 3 The unary operators take one operand and use either prefix notation (such as -x) or postfix notation (such as x++).
- 4 Binary operators. 5 The binary operators take two operands and all use infix notation (such as x + y).
- 6 Ternary operator. 7 Only one ternary operator, ?:, exists; it takes three operands and uses infix notation (c ? x : y).
Paragraph 31 The order of evaluation of operators in an expression is determined by the precedence and associativity of the operators (§14.2.1).
Paragraph 41 The order in which operands in an expression are evaluated, is left to right. [Example: For example, in F(i) + G(i++) * H(i), method F is called using the old value of i, then method G is called with the old value of i, and, finally, method H is called with the new value of i. This is separate from and unrelated to operator precedence. end example] 2 Certain operators can be overloaded. 3 Operator overloading permits user-defined operator implementations to be specified for operations where one or both of the operands are of a user-defined class or struct type (§14.2.2). |
Jagger Software Ltd |
Company # 4070126 |
VAT # 762 5213 42 |

