Queryable.AggregateBy メソッド

定義

オーバーロード

AggregateBy<TSource,TKey,TAccumulate>(IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TKey,TAccumulate>>, Expression<Func<TAccumulate, TSource,TAccumulate>>, IEqualityComparer<TKey>)

ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs

アキュムレータ関数をシーケンスに適用し、結果をキーでグループ化します。

public static System.Linq.IQueryable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Linq.Expressions.Expression<Func<TKey,TAccumulate>> seedSelector, System.Linq.Expressions.Expression<Func<TAccumulate,TSource,TAccumulate>> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Linq.Expressions.Expression<Func<'Key, 'Accumulate>> * System.Linq.Expressions.Expression<Func<'Accumulate, 'Source, 'Accumulate>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.IQueryable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), seedSelector As Expression(Of Func(Of TKey, TAccumulate)), func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IQueryable(Of KeyValuePair(Of TKey, TAccumulate))

型パラメーター

TSource

sourceの要素の型。

TKey

keySelectorによって返されるキーの型。

TAccumulate

アキュムレータ値の型。

パラメーター

source
IQueryable<TSource>

集計する IQueryable<T>

keySelector
Expression<Func<TSource,TKey>>

各要素のキーを抽出する関数。

seedSelector
Expression<Func<TKey,TAccumulate>>

初期アキュムレータ値のファクトリ。

func
Expression<Func<TAccumulate,TSource,TAccumulate>>

各要素で呼び出されるアキュムレータ関数。

keyComparer
IEqualityComparer<TKey>

キーを比較する IEqualityComparer<T>

返品

IQueryable<KeyValuePair<TKey,TAccumulate>>

sourceから派生する各キーに対応する集計を含む列挙可能。

注釈

このメソッドは、各グループにコレクションを割り当てるのではなく、各グループが 1 つの値に集計される GroupBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>) メソッドと同等です。

適用対象

AggregateBy<TSource,TKey,TAccumulate>(IQueryable<TSource>, Expression<Func<TSource, TKey>>, TAccumulate, Expression<Func<TAccumulate,TSource,TAccumulate>>, IEqualityComparer<TKey>)

ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs

アキュムレータ関数をシーケンスに適用し、結果をキーでグループ化します。

public static System.Linq.IQueryable<System.Collections.Generic.KeyValuePair<TKey,TAccumulate>> AggregateBy<TSource,TKey,TAccumulate>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, TAccumulate seed, System.Linq.Expressions.Expression<Func<TAccumulate,TSource,TAccumulate>> func, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer = default);
static member AggregateBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * 'Accumulate * System.Linq.Expressions.Expression<Func<'Accumulate, 'Source, 'Accumulate>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.IQueryable<System.Collections.Generic.KeyValuePair<'Key, 'Accumulate>>
<Extension()>
Public Function AggregateBy(Of TSource, TKey, TAccumulate) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), seed As TAccumulate, func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)), Optional keyComparer As IEqualityComparer(Of TKey) = Nothing) As IQueryable(Of KeyValuePair(Of TKey, TAccumulate))

型パラメーター

TSource

sourceの要素の型。

TKey

keySelectorによって返されるキーの型。

TAccumulate

アキュムレータ値の型。

パラメーター

source
IQueryable<TSource>

集計する IQueryable<T>

keySelector
Expression<Func<TSource,TKey>>

各要素のキーを抽出する関数。

seed
TAccumulate

初期アキュムレータ値。

func
Expression<Func<TAccumulate,TSource,TAccumulate>>

各要素で呼び出されるアキュムレータ関数。

keyComparer
IEqualityComparer<TKey>

キーを比較する IEqualityComparer<T>

返品

IQueryable<KeyValuePair<TKey,TAccumulate>>

sourceから派生する各キーに対応する集計を含む列挙可能。

注釈

このメソッドは、各グループにコレクションを割り当てるのではなく、各グループが 1 つの値に集計される GroupBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>) メソッドと同等です。

適用対象