BinaryOperator Class
A logical expression which consists of a BinaryOperatorType operation between two operands.
Namespace: DevExpress.Data.Filtering
Assembly: DevExpress.Data.v23.1.dll
NuGet Package: DevExpress.Data
Declaration
Related API Members
The following members return BinaryOperator objects:
Remarks
The BinaryOperator can be used in search criteria to filter objects. For more information, refer to Simplified Criteria Syntax, Criteria Operators, and NULL Value Handling Specifics.
Tip
You can find examples in the following article: Build Criteria - Cheat Sheet.
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));
Return orders that have price more or equal to 50.
Expression:
Input:
OrderName | Price |
---|---|
Order1 | 30 |
Order2 | 40 |
Order3 | 50 |
Order4 | 60 |
The result:
OrderName | Price |
---|---|
Order1 | 50 |
Order2 | 60 |
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BinaryOperator class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.