Skip to main content

AggregateOperand.Count() Method

Creates a new AggregateOperand which returns the count of AggregateOperand.CollectionProperty elements that match the AggregateOperand.Condition.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v23.2.dll

NuGet Package: DevExpress.Data

Declaration

public AggregateOperand Count()

Returns

Type Description
AggregateOperand

An AggregateOperand object which calculates an aggregate expression.

Example

Example 1

Get amount of all orders.

Expression:

CriteriaOperator.FromLambda<Order, double>(x => FromLambdaFunctions.TopLevelAggregate<Order>().Count());
Test

Input:

Order

Order0

Order1

The result: 2

Example 2

Get orders with more than 1 order items.

Expression:

CriteriaOperator.FromLambda<Order>(x => x.OrderItems.Count() > 1);
Test

Input:

Order

OrderItem

Order0

Item0-0

Item0-1

Order1

Item1-0

Order2

Item2-0

Item2-1

The result:

Order

Order0

Order2

See Also