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.16 Boolean expressions
Paragraph 11 A boolean-expression is an expression that yields a result of type bool. boolean-expression : expression
Paragraph 21 The controlling conditional expression of an if-statement (§15.7.1), while-statement (§15.8.1), do-statement (§15.8.2), or for-statement (§15.8.3) is a boolean-expression. 2 The controlling conditional expression of the ?: operator (§14.12) follows the same rules as a boolean-expression, but for reasons of operator precedence is classified as a conditional-or-expression.
Paragraph 31 A boolean-expression is required to be of a type that can be implicitly converted to bool or of a type that implements operator true. [Note: As required by §17.9.1, any type that implements operator true must also implement operator false. end note] 2 If neither requirement is satisfied, a compile-time error occurs.
Paragraph 41 When a boolean expression is of a type that cannot be implicitly converted to bool but does implement operator true, then following evaluation of the expression, the operator true implementation provided by that type is invoked to produce a bool value. [Note: The DBBool struct type in §18.4.2 provides an example of a type that implements operator true and operator false. end note] |
Jagger Software Ltd |
Company # 4070126 |
VAT # 762 5213 42 |

