BinaryOperator

Overview

The BinaryOperator enumeration denotes the binary operator applied to operands of a BinaryExpression expression.

For example in this code snippet BinaryOperator value is used to represent equality operand:

WhereExpression where = new BinaryExpression(
                          new FieldExpression("ID"), 
                          new ConstantExpression(42), 
                          BinaryOperator.Equal);

The BinaryOperator enumeration is widely used when Dynamic Where expressions are created in code.

The following table shows how BinaryOperator values are translated into human-readable expressions.

Location


Value Description
Addition left + right
And left and right

or

left && right
Concat left || right
Divide left / right
Equal left = right

or

left == right
Greater left > right
GreaterOrEqual left >= right
In left in right

Usually applied when right operator is a ListExpression expression
Less left < right
LessOrEqual left <= right
Like left LIKE right

where right is a String value that conforms to the template format of the LIKE SQL operation
Modulo left % right
or
left MOD right
or
MOD(left, right)

uses above syntax, depending on database
Multiply left * right
NotEqual left <> right

or

left != right
NotIn left not in right

Usually applied when right operator is a ListExpression expression.


Note: For compability rerasons better approach is to use In operation wrapped in a UnaryOperator operation instead of a single NotIn operation.
NotLike left NOT LIKE right

where right is a String value that conforms to the template format of the NOT LIKE SQL operation
Or left or right

or

left
right
Subtraction left - right
Xor left xor right

or

left ^ right