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.

Namespace:  C1.LiveLinq
Assembly:  C1.LiveLinq (in C1.LiveLinq.dll)

Syntax

C#
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
)
Visual Basic
<ExtensionAttribute> _
Public Shared Function GroupBy(Of TSource, TKey, TElement, TResult) ( _
	source As IIndexedSource(Of TSource), _
	keySelector As Expression(Of Func(Of TSource, TKey)), _
	elementSelector As Expression(Of Func(Of TSource, TElement)), _
	resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TElement), TResult)) _
) As IIndexedSource(Of TResult)

Parameters

source
Type: C1.LiveLinq.Indexing..::..IIndexedSource<(Of <(<'TSource>)>)>
An IIndexedSource<(Of <(<'T>)>)> whose elements to group
keySelector
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'TSource, TKey>)>)>>)>)>
A function to extract the key for each element.
elementSelector
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'TSource, TElement>)>)>>)>)>
A function to map each source element to an element in the IGrouping<(Of <(<'TKey, TElement>)>)>.
resultSelector
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'TKey, IEnumerable<(Of <(<'TElement>)>)>, TResult>)>)>>)>)>
A function to create a result value from each group.

Type Parameters

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<(Of <(<'TKey, TElement>)>)>.
TResult
The type of the result value returned by resultSelector

Return Value

A collection of elements of type TResult where each element represents a projection over a group and its key.

See Also