[]
Groups the elements of a collection according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
public static IIndexedSource<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector)
Type | Name | Description |
---|---|---|
IIndexedSource<TSource> | source | An IIndexedSource<T> whose elements to group |
Expression<Func<TSource, TKey>> | keySelector | A function to extract the key for each element. |
Expression<Func<TSource, TElement>> | elementSelector | A function to map each source element to an element in the IGrouping<TKey, TElement>. |
Expression<Func<TKey, IEnumerable<TElement>, TResult>> | resultSelector | A function to create a result value from each group. |
Type | Description |
---|---|
IIndexedSource<TResult> | A collection of elements of type TResult where each element represents a projection over a group and its key. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |
TElement | The type of the elements in the IGrouping<TKey, TElement>. |
TResult | The type of the result value returned by resultSelector |
Groups the elements of a collection according to a specified key selector function and projects the elements for each group by using a specified function.
public static IIndexedSource<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
Type | Name | Description |
---|---|---|
IIndexedSource<TSource> | source | An IIndexedSource<T> whose elements to group |
Expression<Func<TSource, TKey>> | keySelector | A function to extract the key for each element. |
Expression<Func<TSource, TElement>> | elementSelector | A function to map each source element to an element in the IGrouping<TKey, TElement>. |
Type | Description |
---|---|
IIndexedSource<IGrouping<TKey, TElement>> | A collection of IGrouping<TKey, TElement> objects each containing a collection of objects of type TElement and a key. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |
TElement | The type of the elements in the IGrouping<TKey, TElement>. |
Groups the elements of a collection according to a specified key selector function and creates a result value from each group and its key.
public static IIndexedSource<TResult> GroupBy<TSource, TKey, TResult>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector)
Type | Name | Description |
---|---|---|
IIndexedSource<TSource> | source | An IIndexedSource<T> whose elements to group |
Expression<Func<TSource, TKey>> | keySelector | A function to extract the key for each element. |
Expression<Func<TKey, IEnumerable<TSource>, TResult>> | resultSelector | A function to create a result value from each group. |
Type | Description |
---|---|
IIndexedSource<TResult> | A collection of elements of type TResult where each element represents a projection over a group and its key. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |
TResult | The type of the result value returned by resultSelector |
Groups the elements of a collection according to a specified key selector function.
public static IIndexedSource<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Type | Name | Description |
---|---|---|
IIndexedSource<TSource> | source | An IIndexedSource<T> whose elements to group |
Expression<Func<TSource, TKey>> | keySelector | A function to extract the key for each element. |
Type | Description |
---|---|
IIndexedSource<IGrouping<TKey, TSource>> | A collection of IGrouping<TKey, TElement> objects each containing a sequence of objects and a key. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TKey | The type of the key returned by keySelector. |