[]
        
(Showing Draft Content)

C1.LiveLinq.LiveViews.View-1.GroupBy

GroupBy Method

GroupBy<TKey>(Expression<Func<T, TKey>>)

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

Declaration
public View<GroupView<TKey, T>> GroupBy<TKey>(Expression<Func<T, TKey>> keySelector)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

A function to extract the key for each element.

Returns
Type Description
View<GroupView<TKey, T>>

A view containing elements of type GroupView<TKey, TElement> each containing a key value and a view of the elements having that key value.

Type Parameters
Name Description
TKey

The type of the key returned by keySelector.

GroupBy<TKey, TElement>(Expression<Func<T, TKey>>, Expression<Func<T, TElement>>)

Groups the elements of a view according to a specified key selector function and projects the elements for each group by using a specified function.

Declaration
public View<GroupView<TKey, TElement>> GroupBy<TKey, TElement>(Expression<Func<T, TKey>> keySelector, Expression<Func<T, TElement>> elementSelector)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

A function to extract the key for each element.

Expression<Func<T, TElement>> elementSelector

A function to map each source element to a TElement.

Returns
Type Description
View<GroupView<TKey, TElement>>

A view containing elements of type GroupView<TKey, TElement> each containing a key value and a view of the elements projected (mapped) from the elements having that key value.

Type Parameters
Name Description
TKey

The type of the key returned by keySelector.

TElement

The type of the element to which elements of each group are projected.

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

Groups the elements of a view 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 View<TResult> GroupBy<TKey, TElement, TResult>(Expression<Func<T, TKey>> keySelector, Expression<Func<T, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

A function to extract the key for each element.

Expression<Func<T, 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
View<TResult>

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

Type Parameters
Name Description
TKey

The type of the key returned by keySelector.

TElement

The type of the elements in groups.

TResult

The type of the result value returned by resultSelector.