[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Applies in parallel an accumulator function over a sequence. This overload is not available in the sequential implementation.
Namespace:
System.Linq
Assembly:
System.Core (in System.Core.dll)
Visual Basic (Declaration)
<ExtensionAttribute> _
Public Shared Function Aggregate(Of TSource, TAccumulate, TResult) ( _
source As ParallelQuery(Of TSource), _
seed As TAccumulate, _
updateAccumulatorFunc As Func(Of TAccumulate, TSource, TAccumulate), _
combineAccumulatorsFunc As Func(Of TAccumulate, TAccumulate, TAccumulate), _
resultSelector As Func(Of TAccumulate, TResult) _
) As TResult
Dim source As ParallelQuery(Of TSource)
Dim seed As TAccumulate
Dim updateAccumulatorFunc As Func(Of TAccumulate, TSource, TAccumulate)
Dim combineAccumulatorsFunc As Func(Of TAccumulate, TAccumulate, TAccumulate)
Dim resultSelector As Func(Of TAccumulate, TResult)
Dim returnValue As TResult
returnValue = source.Aggregate(seed, _
updateAccumulatorFunc, combineAccumulatorsFunc, _
resultSelector)
public static TResult Aggregate<TSource, TAccumulate, TResult>(
this ParallelQuery<TSource> source,
TAccumulate seed,
Func<TAccumulate, TSource, TAccumulate> updateAccumulatorFunc,
Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc,
Func<TAccumulate, TResult> resultSelector
)
[ExtensionAttribute]
public:
generic<typename TSource, typename TAccumulate, typename TResult>
static TResult Aggregate(
ParallelQuery<TSource>^ source,
TAccumulate seed,
Func<TAccumulate, TSource, TAccumulate>^ updateAccumulatorFunc,
Func<TAccumulate, TAccumulate, TAccumulate>^ combineAccumulatorsFunc,
Func<TAccumulate, TResult>^ resultSelector
)
static member Aggregate :
source:ParallelQuery<'TSource> *
seed:'TAccumulate *
updateAccumulatorFunc:Func<'TAccumulate, 'TSource, 'TAccumulate> *
combineAccumulatorsFunc:Func<'TAccumulate, 'TAccumulate, 'TAccumulate> *
resultSelector:Func<'TAccumulate, 'TResult> -> 'TResult
Type Parameters
- TSource
The type of the elements of source.
- TAccumulate
The type of the accumulator value.
- TResult
The type of the resulting value.
Parameters
- source
- Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
A sequence to aggregate over.
- seed
- Type: TAccumulate
The initial accumulator value.
- updateAccumulatorFunc
- Type: System..::.Func<(Of <(TAccumulate, TSource, TAccumulate>)>)
An accumulator function to be invoked on each element in a partition.
- combineAccumulatorsFunc
- Type: System..::.Func<(Of <(TAccumulate, TAccumulate, TAccumulate>)>)
An accumulator function to be invoked on the yielded element from each partition.
- resultSelector
- Type: System..::.Func<(Of <(TAccumulate, TResult>)>)
A function to transform the final accumulator value into the result value.
Return Value
Type: TResult
The transformed final accumulator value.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type ParallelQuery<(Of <(TSource>)>). 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).
This overload is specific to processing a parallelized query. A parallelized query may partition the data source sequence into several sub-sequences (partitions). The updateAccumulatorFunc is invoked on each element within partitions. Each partition then yields a single accumulated result. The combineAccumulatorsFunc is then invoked on the results of each partition to yield a single element. This element is then transformed by the resultSelector function.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 4
.NET Framework Client Profile
Supported in: 4
Reference