Boolean Logical Operators

A lot of readers will have thought of Boolean values by now in the context of our discussion of logical operators. Yet I’ve kept Boolean logical operators for the last for a good reason: short-circuiting variants exist, also known as the conditional logical operators.

But first, the regular non-short-circuiting ones. No surprises here: Standard Boolean logic applies for AND, OR, XOR, and NOT, which are written as follows, respectively:

&  |  ^  !

Obviously, the result of those Boolean operators is a Boolean itself. However, from the truth tables of the AND and OR operators, you might recall some important properties of those operators: They can be short-circuited. To refresh your memory on this subject, take a look at ...

Get C# 5.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.