[]
        
(Showing Draft Content)

C1.LiveLinq.IndexedQueryExtensions.GroupBy

GroupBy Method

GroupBy<TSource, TKey, TElement, TResult>(IIndexedSource<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>, Expression<Func<TKey, IEnumerable<TElement>, TResult>>)

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.

Declaration
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)
Parameters
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.

Returns
Type Description
IIndexedSource<TResult>

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

Type Parameters
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

GroupBy<TSource, TKey, TElement>(IIndexedSource<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>)

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.

Declaration
public static IIndexedSource<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
Parameters
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>.

Returns
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.

Type Parameters
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>.

GroupBy<TSource, TKey, TResult>(IIndexedSource<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TKey, IEnumerable<TSource>, TResult>>)

Groups the elements of a collection according to a specified key selector function and creates a result value from each group and its key.

Declaration
public static IIndexedSource<TResult> GroupBy<TSource, TKey, TResult>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector)
Parameters
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.

Returns
Type Description
IIndexedSource<TResult>

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

Type Parameters
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

GroupBy<TSource, TKey>(IIndexedSource<TSource>, Expression<Func<TSource, TKey>>)

Groups the elements of a collection according to a specified key selector function.

Declaration
public static IIndexedSource<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Parameters
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.

Returns
Type Description
IIndexedSource<IGrouping<TKey, TSource>>

A collection of IGrouping<TKey, TElement> objects each containing a sequence of objects and a key.

Type Parameters
Name Description
TSource

The type of the elements of source.

TKey

The type of the key returned by keySelector.