Skip to main content

UnaryOperator Class

An unary operator which performs an operation on only one expression.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public class UnaryOperator :
    CriteriaOperator

The following members return UnaryOperator objects:

Remarks

To create an unary operator, create a new instance of the UnaryOperator class with the specified settings. The UnaryOperator.OperatorType property specifies the type of the unary operator.

For more information on building criteria, see Simplified Criteria Syntax.

Tip

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

Example

Example 1

Return orders that have Price is not between 20 and 30.

Expression:

CriteriaOperator.FromLambda<Order>(o => !(o.Price >= 20 && o.Price <= 30));
Test

Input:

OrderName

Price

Order0

10

Order1

20

Order2

30

Order3

40

The result:

OrderName

Order0

Order3

Example 2

Return order items with the Order property references to null.

Expression:

CriteriaOperator.FromLambda<OrderItem>(oi => oi.Order == null);
Test

Input:

OrderItemName

Order

OrderItem0

null

OrderItem1

Order1

The result:

OrderItemName

OrderItem0

See Also