Skip to main content

AggregateOperand.Min(CriteriaOperator) Method

Creates a new AggregateOperand which returns the minimum of the values calculated by the given aggregate expression. This expression is evaluated against elements of the AggregateOperand.CollectionProperty that match the specified AggregateOperand.Condition.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public AggregateOperand Min(
    CriteriaOperator aggregatedExpression
)

Parameters

Name Type Description
aggregatedExpression CriteriaOperator

A CriteriaOperator object which specifies the aggregate expression.

Returns

Type Description
AggregateOperand

An AggregateOperand object which calculates an aggregate expression.

Example

Example 1

Gets the min value from a collection.

Expression:

CriteriaOperator.FromLambda<Order, int>(o => o.OrderItems.Min(oi => oi.ItemPrice));
Test

Input:

Order

OrderItemName

ItemPrice

Order0

OrderItem1

10

OrderItem2

20

The result: 10

Example 2

Get the min value from a filtered collection.

Expression:

CriteriaOperator.FromLambda<Order, int>(o => o.OrderItems.Where(oi => oi.IsAvailable == true).Min(oi => oi.ItemPrice)); ;
Test

Input:

Order

OrderItemName

ItemPrice

IsAvailable

Order0

OrderItem1

10

False

OrderItem2

20

True

OrderItem2

30

True

OrderItem2

40

False

The result: 20

See Also