Skip to content

AverageAsync Method ​

Definition ​

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Task<Nullable<decimal>> AverageAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken cancellationToken = null) ​

csharp
Task<Nullable<decimal>> AverageAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken cancellationToken = null)

Computes the average of the specified property for rows matching the optional predicate.

Type parameters ​

NameDescription
TThe entity (row) type.

Parameters ​

NameDescription
ctCancellation token.
distinctIf true, averages over distinct values.
predicateOptional predicate to filter rows.
propertyProperty selector to aggregate.

Returns ​

The computed average, or null if no rows match.