ECMA-334 C# Language Specification14.11.1: Boolean conditional logical operators |
When the operands of && or || are of type bool , or when the operands are of types that do not define an applicable operator & or operator |, but do define implicit conversions to bool , the operation is processed as follows:
- The operation x && y is evaluated as x ? y : false. In other words, x is first evaluated and converted to type bool . Then, if x is true, y is evaluated and converted to type bool , and this becomes the result of the operation. Otherwise, the result of the operation is false.
- The operation x || y is evaluated as x ? true : y. In other words, x is first evaluated and converted to type bool . Then, if x is true, the result of the operation is true. Otherwise, y is evaluated and converted to type bool , and this becomes the result of the operation.