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.
Namespace:
C1.LiveLinqAssembly: C1.LiveLinq (in C1.LiveLinq.dll)
Syntax
C# |
---|
public static IIndexedSource<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>( this IIndexedSource<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector ) |
Visual Basic |
---|
<ExtensionAttribute> _ Public Shared Function GroupBy(Of TSource, TKey, TElement) ( _ source As IIndexedSource(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ elementSelector As Expression(Of Func(Of TSource, TElement)) _ ) As IIndexedSource(Of IGrouping(Of TKey, TElement)) |
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>)>)>.
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>)>)>.