ECMA-334 C# Language Specification

14.10: Logical operators

The &, ^, and | operators are called the logical operators.

and-expression
equality-expression
and-expression & equality-expression
exclusive-or-expression
and-expression
exclusive-or-expression ^ and-expression
inclusive-or-expression
exclusive-or-expression
inclusive-or-expression | exclusive-or-expression

For an operation of the form x op y, where op is one of the logical operators, overload resolution (14.2.4) is applied to select a specific operator implementation. The operands are converted to the parameter types of the selected operator, and the type of the result is the return type of the operator.

The predefined logical operators are described in the following sections.

In This Section: