AsyncEnumerable.AggregateBy Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
AggregateBy<TSource,TKey,TAccumulate>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,TAccumulate>, Func<TAccumulate, TSource,TAccumulate>, IEqualityComparer<TKey>)
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
Применяет функцию аккуматора по последовательности, группируя результаты по ключу.
public static System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<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 : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * Func<'Key, 'Accumulate> * Func<'Accumulate, 'Source, 'Accumulate> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IAsyncEnumerable(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 IAsyncEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа, возвращаемого keySelector.
- TAccumulate
Тип значения аккумулятора.
Параметры
- source
- IAsyncEnumerable<TSource>
Значение IAsyncEnumerable<T> для агрегирования.
- keySelector
- Func<TSource,TKey>
Функция для извлечения ключа для каждого элемента.
- seedSelector
- Func<TKey,TAccumulate>
Фабрика для начального значения аккумулятора.
- func
- Func<TAccumulate,TSource,TAccumulate>
Вызываемая функция-аккумулятор для каждого элемента.
- keyComparer
- IEqualityComparer<TKey>
Сравнение IEqualityComparer<T> ключей с.
Возвращаемое значение
Перечисление, содержащее агрегаты, соответствующие каждому ключу, производным от source.
Исключения
func равно null.
Комментарии
Этот метод сравним с методами GroupBy, в которых каждое группирование объединяется в одно значение, а не выделение коллекции для каждой группы.
Применяется к
AggregateBy<TSource,TKey,TAccumulate>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>)
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
Применяет функцию аккуматора по последовательности, группируя результаты по ключу.
public static System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, TAccumulate seed, Func<TAccumulate,TSource,TAccumulate> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * 'Accumulate * Func<'Accumulate, 'Source, 'Accumulate> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IAsyncEnumerable(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 IAsyncEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа, возвращаемого keySelector.
- TAccumulate
Тип значения аккумулятора.
Параметры
- source
- IAsyncEnumerable<TSource>
Значение IAsyncEnumerable<T> для агрегирования.
- keySelector
- Func<TSource,TKey>
Функция для извлечения ключа для каждого элемента.
- seed
- TAccumulate
Начальное значение аккумулятора.
- func
- Func<TAccumulate,TSource,TAccumulate>
Вызываемая функция-аккумулятор для каждого элемента.
- keyComparer
- IEqualityComparer<TKey>
Сравнение IEqualityComparer<T> ключей с.
Возвращаемое значение
Перечисление, содержащее агрегаты, соответствующие каждому ключу, производным от source.
Исключения
func равно null.
Комментарии
Этот метод сравним с методами GroupBy, в которых каждое группирование объединяется в одно значение, а не выделение коллекции для каждой группы.
Применяется к
AggregateBy<TSource,TKey,TAccumulate>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, Func<TKey,CancellationToken, ValueTask<TAccumulate>>, Func<TAccumulate,TSource,CancellationToken, ValueTask<TAccumulate>>, IEqualityComparer<TKey>)
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
Применяет функцию аккуматора по последовательности, группируя результаты по ключу.
public static System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, Func<TKey,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TAccumulate>> seedSelector, Func<TAccumulate,TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TAccumulate>> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * Func<'Key, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Accumulate>> * Func<'Accumulate, 'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Accumulate>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), seedSelector As Func(Of TKey, CancellationToken, ValueTask(Of TAccumulate)), func As Func(Of TAccumulate, TSource, CancellationToken, ValueTask(Of TAccumulate)), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа, возвращаемого keySelector.
- TAccumulate
Тип значения аккумулятора.
Параметры
- source
- IAsyncEnumerable<TSource>
Значение IAsyncEnumerable<T> для агрегирования.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
Функция для извлечения ключа для каждого элемента.
- seedSelector
- Func<TKey,CancellationToken,ValueTask<TAccumulate>>
Фабрика для начального значения аккумулятора.
- func
- Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>
Вызываемая функция-аккумулятор для каждого элемента.
- keyComparer
- IEqualityComparer<TKey>
Сравнение IEqualityComparer<T> ключей с.
Возвращаемое значение
Перечисление, содержащее агрегаты, соответствующие каждому ключу, производным от source.
Исключения
func равно null.
Комментарии
Этот метод сравним с методами GroupBy, в которых каждое группирование объединяется в одно значение, а не выделение коллекции для каждой группы.
Применяется к
AggregateBy<TSource,TKey,TAccumulate>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, TAccumulate, Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>, IEqualityComparer<TKey>)
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
- Исходный код:
- AggregateBy.cs
Применяет функцию аккуматора по последовательности, группируя результаты по ключу.
public static System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, TAccumulate seed, Func<TAccumulate,TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TAccumulate>> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * 'Accumulate * Func<'Accumulate, 'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Accumulate>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), seed As TAccumulate, func As Func(Of TAccumulate, TSource, CancellationToken, ValueTask(Of TAccumulate)), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of KeyValuePair(Of TKey, TAccumulate))
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа, возвращаемого keySelector.
- TAccumulate
Тип значения аккумулятора.
Параметры
- source
- IAsyncEnumerable<TSource>
Значение IAsyncEnumerable<T> для агрегирования.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
Функция для извлечения ключа для каждого элемента.
- seed
- TAccumulate
Начальное значение аккумулятора.
- func
- Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>
Вызываемая функция-аккумулятор для каждого элемента.
- keyComparer
- IEqualityComparer<TKey>
Сравнение IEqualityComparer<T> ключей с.
Возвращаемое значение
Перечисление, содержащее агрегаты, соответствующие каждому ключу, производным от source.
Исключения
func равно null.
Комментарии
Этот метод сравним с методами GroupBy, в которых каждое группирование объединяется в одно значение, а не выделение коллекции для каждой группы.