Skip to main content

BetweenOperator Class

An operator which determines whether a criteria expression lies between the specified range of values.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public sealed class BetweenOperator :
    CriteriaOperator

The following members return BetweenOperator objects:

Remarks

The BetweenOperator can be used to build criteria expressions when filtering objects. To learn more, see Simplified Criteria Syntax and Criteria Operators.

To create a between operator, create a new instance of the BetweenOperator class. The constructor’s parameters allow the lower and upper values in the range to be specified.

Note

The upper and lower values in the range are included in the range.

Tip

You can find examples in the following article: Build Criteria - Cheat Sheet.

Example

Get items from collection that have a property’s values between specified arguments.

Expression:

//Although there is no LINQ expression that generates the BetweenOperator you can solve this task using the following expression
CriteriaOperator.FromLambda<OrderItem>(oi => oi.ItemPrice >= 10 && oi.ItemPrice <= 30);
Test

Input:

OrderItemName

ItemPrice

OrderItem1

10

OrderItem2

20

OrderItem3

30

OrderItem4

40

The result:

OrderItemName

ItemPrice

OrderItem1

10

OrderItem2

20

OrderItem3

30

Inheritance

Object
CriteriaOperator
BetweenOperator
See Also