Skip to main content

InOperator Class

An operator which determines if a value matches any value in a specified list.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v23.2.dll

NuGet Package: DevExpress.Data

Declaration

public class InOperator :
    CriteriaOperator

The following members return InOperator objects:

Remarks

The InOperator builds criteria expressions. To learn more, see Creating Criteria and Criteria Operators.

In this example, the XPCollection is filtered to display persons whose names are specified in the list.

xpCollection1.Filter = new InOperator("Name", new string[] {"John", "Mike", "Nick"});

The image below shows the result:

INOperator

Note

You cannot apply InOperator to collection properties. To check if a collection contains at least one object that matches a specific criterion, use the ContainsOperator instead.

Tip

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

Example

Get order with the OrderName property ore one of the follows values: ‘Order2’, ‘Order3’,’Description5’.

Expression:

CriteriaOperator.FromLambda<Order, bool>(o => new string[] { "Order2", "Order3", "Description5" }.Contains(o.OrderName));
Test

Input:

OrderName

Order0

Order1

Order2

Order3

The result:

OrderName

Order2

Order3

Inheritance

See Also