AFAggregate.AggregateAsync(T) Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Performs all requested aggregates on the specified items asynchronously.
Namespace: OSIsoft.AF.Data.Aggregate
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static Task<AFAggregateResultCollection> AggregateAsync<T>( this IEnumerable<T> items, IEnumerable<AFAggregateRequest> aggregateRequests, CancellationToken cancellationToken ) where T : AFObject
<ExtensionAttribute> Public Shared Function AggregateAsync(Of T As AFObject) ( items As IEnumerable(Of T), aggregateRequests As IEnumerable(Of AFAggregateRequest), cancellationToken As CancellationToken ) As Task(Of AFAggregateResultCollection) Dim items As IEnumerable(Of T) Dim aggregateRequests As IEnumerable(Of AFAggregateRequest) Dim cancellationToken As CancellationToken Dim returnValue As Task(Of AFAggregateResultCollection) returnValue = items.AggregateAsync(aggregateRequests, cancellationToken)
public: [ExtensionAttribute] generic<typename T> where T : AFObject static Task<AFAggregateResultCollection^>^ AggregateAsync( IEnumerable<T>^ items, IEnumerable<AFAggregateRequest^>^ aggregateRequests, CancellationToken cancellationToken )
[<ExtensionAttribute>] static member AggregateAsync : items : IEnumerable<'T> * aggregateRequests : IEnumerable<AFAggregateRequest> * cancellationToken : CancellationToken -> Task<AFAggregateResultCollection> when 'T : AFObject
Parameters
- items
- Type: System.Collections.GenericIEnumerableT
The items that should be summarized. - aggregateRequests
- Type: System.Collections.GenericIEnumerableAFAggregateRequest
All aggregates that should be performed on the items. - cancellationToken
- Type: System.ThreadingCancellationToken
A token to control cancellation of the aggregation request.
Type Parameters
- T
- The type of items to summarize
Return Value
Type: TaskAFAggregateResultCollectionAn AFAggregateResultCollection containing the results of the requested aggregates or errors if the aggregates could not be performed.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
| This call might use a background task to complete some of its work. See the Threading Overview for some matters to consider when execution transitions to another thread. |