Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, Func<TKey,TAccumulate>, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>) |
Applies an accumulator function over a sequence, grouping results by key. |
AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>) |
Applies an accumulator function over a sequence, grouping results by key. |
Applies an accumulator function over a sequence, grouping results by key.
public static System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TKey,TAccumulate> seedSelector, Func<TAccumulate,TSource,TAccumulate> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : seq<'Source> * Func<'Source, 'Key> * Func<'Key, 'Accumulate> * Func<'Accumulate, 'Source, 'Accumulate> * System.Collections.Generic.IEqualityComparer<'Key> -> seq<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), seedSelector As Func(Of TKey, TAccumulate), func As Func(Of TAccumulate, TSource, TAccumulate), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the accumulator value.
An IEnumerable<T> to aggregate over.
A function to extract the key for each element.
A factory for the initial accumulator value.
An accumulator function to be invoked on each element.
An IEqualityComparer<T> to compare keys with.
An enumerable containing the aggregates corresponding to each key deriving from source
.
This method is comparable to the GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>) methods where each grouping is being aggregated into a single value as opposed to allocating a collection for each group.
Product | Versions |
---|---|
.NET | 9, 10 |
Applies an accumulator function over a sequence, grouping results by key.
public static System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, TAccumulate seed, Func<TAccumulate,TSource,TAccumulate> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : seq<'Source> * Func<'Source, 'Key> * 'Accumulate * Func<'Accumulate, 'Source, 'Accumulate> * System.Collections.Generic.IEqualityComparer<'Key> -> seq<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), seed As TAccumulate, func As Func(Of TAccumulate, TSource, TAccumulate), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the accumulator value.
An IEnumerable<T> to aggregate over.
A function to extract the key for each element.
The initial accumulator value.
An accumulator function to be invoked on each element.
An IEqualityComparer<T> to compare keys with.
An enumerable containing the aggregates corresponding to each key deriving from source
.
This method is comparable to the GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>) methods where each grouping is being aggregated into a single value as opposed to allocating a collection for each group.
Product | Versions |
---|---|
.NET | 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in