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.11 Conditional logical operators
Paragraph 11 The && and || operators are called the conditional logical operators. 2 They are also called the "short-circuiting" logical operators. conditional-and-expression : inclusive-or-expression conditional-and-expression && inclusive-or-expression conditional-or-expression : conditional-and-expression conditional-or-expression || conditional-and-expression
Paragraph 21 The && and || operators are conditional versions of the & and | operators:
Paragraph 31 An operation of the form x && y or x || y is processed by applying overload resolution (§14.2.4) as if the operation was written x & y or x | y. 2 Then,
- 2 The operation x && y corresponds to the operation x & y, except that y is evaluated only if x is true.
- 3 The operation x || y corresponds to the operation x | y, except that y is evaluated only if x is false.
Paragraph 41 It is not possible to directly overload the conditional logical operators. 2 However, because the conditional logical operators are evaluated in terms of the regular logical operators, overloads of the regular logical operators are, with certain restrictions, also considered overloads of the conditional logical operators. 3 This is described further in §14.11.2.
- 3 If overload resolution fails to find a single best operator, or if overload resolution selects one of the predefined integer logical operators, a compile-time error occurs.
- 4 Otherwise, if the selected operator is one of the predefined boolean logical operators (§14.10.2), the operation is processed as described in §14.11.1.
- 5 Otherwise, the selected operator is a user-defined operator, and the operation is processed as described in §14.11.2.
|Jagger Software Ltd|
|Company # 4070126|
|VAT # 762 5213 42|