Skip to content

M_CodeJam_Collections_EnumerableExtensions_GroupWhileEquals__2

Andrew Koryavchenko edited this page Jun 17, 2018 · 2 revisions

EnumerableExtensions.GroupWhileEquals(T, TKey) Method (IEnumerable(T), Func(T, TKey))

Groups items in the sequence while they have same grouping key.

Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static IEnumerable<IGrouping<TKey, T>> GroupWhileEquals<T, TKey>(
	this IEnumerable<T> source,
	Func<T, TKey> keySelector
)

VB

<ExtensionAttribute>
Public Shared Function GroupWhileEquals(Of T, TKey) ( 
	source As IEnumerable(Of T),
	keySelector As Func(Of T, TKey)
) As IEnumerable(Of IGrouping(Of TKey, T))

F#

[<ExtensionAttribute>]
static member GroupWhileEquals : 
        source : IEnumerable<'T> * 
        keySelector : Func<'T, 'TKey> -> IEnumerable<IGrouping<'TKey, 'T>> 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(T)
The source.
keySelector
Type: System.Func(T, TKey)
The grouping key selector.

Type Parameters

 

T
Type of items in sequence
TKey
The type of the grouping key.

Return Value

Type: IEnumerable(IGrouping(TKey, T))
Grouped items with grouping key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

EnumerableExtensions Class
GroupWhileEquals Overload
CodeJam.Collections Namespace

Clone this wiki locally