System.Linq.Expressions.BinaryExpression class

This article provides supplementary remarks to the reference documentation for this API.

The BinaryExpression class represents an expression that has a binary operator.

The following tables summarize the factory methods that can be used to create a BinaryExpression that has a specific node type, represented by the NodeType property. Each table contains information for a specific class of operations such as arithmetic or bitwise.

Binary arithmetic operations

Node Type Factory Method
Add Add
AddChecked AddChecked
Divide Divide
Modulo Modulo
Multiply Multiply
MultiplyChecked MultiplyChecked
Power Power
Subtract Subtract
SubtractChecked SubtractChecked

Bitwise operations

Node Type Factory Method
And And
Or Or
ExclusiveOr ExclusiveOr

Shift operations

Node Type Factory Method
LeftShift LeftShift
RightShift RightShift

Conditional Boolean operations

Node Type Factory Method
AndAlso AndAlso
OrElse OrElse

Comparison operations

Node Type Factory Method
Equal Equal
NotEqual NotEqual
GreaterThanOrEqual GreaterThanOrEqual
GreaterThan GreaterThan
LessThan LessThan
LessThanOrEqual LessThanOrEqual

Coalescing operations

Node Type Factory Method
Coalesce Coalesce

Array indexing operations

Node Type Factory Method
ArrayIndex ArrayIndex

In addition, the MakeBinary methods can also be used to create a BinaryExpression. These factory methods can be used to create a BinaryExpression of any node type that represents a binary operation. The parameter of these methods that is of type NodeType specifies the desired node type.