C# Logical Operators

Logical Operators
Logical operators perform Boolean logic on two expressions. There are three types of logical operators in C#: bitwise, Boolean, and conditional.
The bitwise logical operators perform Boolean logic on corresponding bits of two integral expressions. Valid integral types are the signed and unsigned int and long types. C#
promotes byte to int, which is why the example in the prevous section worked. The bitwise logical operators return a compatible integral result with each bit conforming to
the Boolean evaluation.
Boolean logical operators perform Boolean logic upon two Boolean expressions. The expression on the left is evaluated, and then the expression on the right is evaluated. Finally, the
two expressions are evaluated together in the context of the Boolean logical operator between them. They return a bool result corresponding to the type of operator used.
The conditional logical operators operate much the same way as the Boolean logical operators with one exception: When the first expression is evaluated and found to satisfy the
results of the entire expression, the second expression is not evaluated. This is efficient because it doesn’t make sense to continue evaluating an expression when the result is
already known.
原文地址:https://www.cnblogs.com/taoxu0903/p/1670619.html