BinaryOperatorType Enum

Enumerates binary operator types.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v20.1.dll

Declaration

public enum BinaryOperatorType
Public Enum BinaryOperatorType

Members

Name Description
Equal

Represents the Boolean equality operator.

To create the Boolean equality operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 = Field2")

NotEqual

Represents the Boolean inequality operator.

To create the Boolean inequality operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 != Field2") or CriteriaOperator.Parse("Field1 <> Field2")

Greater

Represents the Boolean greater-than operator.

To create the Boolean greater-than operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 > Field2")

Less

Represents the Boolean less-than operator.

To create the Boolean less-than operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 < Field2")

LessOrEqual

Represents the Boolean less-than-or-equal-to operator.

To create the Boolean less-than-or-equal-to operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 <= Field2")

GreaterOrEqual

Represents the Boolean greater-than-or-equal-to operator.

To create the Boolean greater-than-or-equal-to operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 >= Field2")

Like

Obsolete. The LIKE operator. This operator behavior is different, depending on current circumstances. We recommend that you use StartsWith, Contains and EndsWith function operators instead of Like, where possible.

BitwiseAnd

Represents the bitwise AND operator.

To create the bitwise AND operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 & 128 = 128")

BitwiseOr

Represents the bitwise OR operator.

To create the bitwise OR operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 | 3")

BitwiseXor

Represents the bitwise XOR operator.

To create the bitwise XOR operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("(Field1 ^ Field2) = 1")

Divide

Represents the division operator.

To create the division operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 / Field2 = 2")

Modulo

Represents the modulus operator (computes the remainder after dividing its first operand by its second).

To create the modulus operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 % Field2 = 1")

Multiply

Represents the multiplication operator.

To create the multiplication operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 * Field2 = 100")

Plus

Represents the addition operator.

To create the addition operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 + Field2 = 20")

Minus

Represents the subtraction operator.

To create the subtraction operator using the CriteriaOperator.Parse method use the following syntax:

CriteriaOperator.Parse("Field1 - Field2 = 10")

Remarks

This enumeration contains binary operator types that can be used to create filter criteria via the BinaryOperator objects.

Examples

The following code demonstrates how to get a collection of "MyObject" objects that match specific criteria. The collection returned is used as a data source for a grid control. In this example, objects that have a value equal to or greater than 20 in their "UnitPrice" field are returned. To create the filter criteria a specific BinaryOperator operator is used.

using DevExpress.Xpo;
using DevExpress.Data.Filtering;

// Custom XP object.
class MyObject : XPObject {
   decimal unitPrice;

   public decimal UnitPrice {
      get { return unitPrice; }
      set { unitPrice = value; }
   }
   //...
}

// Select MyObject objects that match the specified criteria.
decimal filterValue = 20;
gridControl1.DataSource = new XPCollection(Session.DefaultSession, typeof(MyObject), 
  new BinaryOperator("UnitPrice", filterValue, BinaryOperatorType.GreaterOrEqual));
See Also