LinqExtensions.GroupBy Method

Definition

Namespace: Extreme.DataAnalysis.Linq
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

GroupBy<T, TKey>(Vector<T>, Func<T, TKey>) Groups the elements of a vector according to the specified key selector function.
GroupBy<T, TKey>(Vector<T>, Func<T, TKey>, IEqualityComparer<TKey>) Groups the elements of a vector according to the specified key selector function and key comparer.
GroupBy<R, C, TKey>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>) Groups the rows of a data frame based on the specified key selector.
GroupBy<R, C, TKey>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, IEqualityComparer<TKey>) Groups the rows of a data frame based on the specified key selector.
GroupBy<T, TKey, TElement>(Vector<T>, Func<T, TKey>, Func<T, TElement>) Groups the elements of a vector according to the specified key selector and element selector functions.
GroupBy<T, TKey, TResult>(Vector<T>, Func<T, TKey>, Func<TKey, IEnumerable<T>, TResult>) Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key.
GroupBy<T, TKey, TElement>(Vector<T>, Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>) Groups the elements of a vector according to the specified key selector and element selector functions, and key comparer.
GroupBy<T, TKey, TResult>(Vector<T>, Func<T, TKey>, Func<TKey, IEnumerable<T>, TResult>, IEqualityComparer<TKey>) Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. Key values are compared using the specified comparer.
GroupBy<R, C, TKey, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
GroupBy<R, C, TKey, TElement>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
GroupBy<R, C, TKey, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>, IEqualityComparer<TKey>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
GroupBy<R, C, TKey, TElement>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, IEqualityComparer<TKey>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
GroupBy<T, TKey, TElement, TResult>(Vector<T>, Func<T, TKey>, Func<T, TElement>, Func<TKey, IEnumerable<TElement>, TResult>) Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. The elements of each group are projected using the specified function.
GroupBy<T, TKey, TElement, TResult>(Vector<T>, Func<T, TKey>, Func<T, TElement>, Func<TKey, IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>) Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. Key values are compared using the specified comparer, and the elements of each group are projected using the specified function.
GroupBy<R, C, TKey, TElement, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
GroupBy<R, C, TKey, TElement, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>) Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.

GroupBy<R, C, TKey>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>)

Groups the rows of a data frame based on the specified key selector.
C#
public static LinqExtensions.DataFrameLookup<TKey, R, C> GroupBy<R, C, TKey>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.

Return Value

LinqExtensions.DataFrameLookup<TKey, R, C>
A LinqExtensions.Lookup<TKey, T> containing the groupings of rows in frame where keys are evaluated using keySelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

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

Groups the elements of a vector according to the specified key selector function.
C#
public static LinqExtensions.Lookup<TKey, T> GroupBy<T, TKey>(
	this Vector<T> vector,
	Func<T, TKey> keySelector
)

Parameters

vector  Vector<T>
The vector whose elements to group.
keySelector  Func<T, TKey>
A function to extract the key from each element.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the keys.

Return Value

LinqExtensions.Lookup<TKey, T>

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

GroupBy<R, C, TKey>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, IEqualityComparer<TKey>)

Groups the rows of a data frame based on the specified key selector.
C#
public static LinqExtensions.DataFrameLookup<TKey, R, C> GroupBy<R, C, TKey>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	IEqualityComparer<TKey> comparer
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
comparer  IEqualityComparer<TKey>
A comparer for keys.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.

Return Value

LinqExtensions.DataFrameLookup<TKey, R, C>
A LinqExtensions.Lookup<TKey, T> containing the groupings of rows in frame where group membership is determined by applying comparer to the result of applying keySelector to each row of the data frame.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<R, C, TKey, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static Vector<TResult> GroupBy<R, C, TKey, TResult>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult> resultSelector
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
resultSelector  Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>
A function that maps a group with key of type TKey and a collection of data frame rows to a value of type TResult.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TResult
The element type of the result.

Return Value

Vector<TResult>
A vector containing the result of applying resultSelector to each group of rows in frame where keys are evaluated using keySelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<R, C, TKey, TElement>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static LinqExtensions.Lookup<TKey, TElement> GroupBy<R, C, TKey, TElement>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<DataFrameRow<R, C>, TElement> elementSelector
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
elementSelector  Func<DataFrameRow<R, C>, TElement>
A function that maps a row of the data frame to a value of type TElement.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TElement
The type of the elements of each group.

Return Value

LinqExtensions.Lookup<TKey, TElement>
A LinqExtensions.Lookup<TKey, T> containing the groupings of rows in frame where keys are evaluated using keySelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<T, TKey>(Vector<T>, Func<T, TKey>, IEqualityComparer<TKey>)

Groups the elements of a vector according to the specified key selector function and key comparer.
C#
public static LinqExtensions.Lookup<TKey, T> GroupBy<T, TKey>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	IEqualityComparer<TKey> comparer
)

Parameters

vector  Vector<T>
The vector to create a lookup from.
keySelector  Func<T, TKey>
A function to extract a key from each element.
comparer  IEqualityComparer<TKey>
An object that compares two keys for equality.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the key returned by the key selector.

Return Value

LinqExtensions.Lookup<TKey, T>
A lookup that contains keys and values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

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

Groups the elements of a vector according to the specified key selector and element selector functions.
C#
public static LinqExtensions.Lookup<TKey, TElement> GroupBy<T, TKey, TElement>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<T, TElement> elementSelector
)

Parameters

vector  Vector<T>
The vector to create a lookup from.
keySelector  Func<T, TKey>
A function to extract a key from each element.
elementSelector  Func<T, TElement>
A function that transforms each input element.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the key returned by the key selector.
TElement
The type of the value returned by the element selector.

Return Value

LinqExtensions.Lookup<TKey, TElement>
A lookup that contains keys and values selected from the input using elementSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

GroupBy<T, TKey, TResult>(Vector<T>, Func<T, TKey>, Func<TKey, IEnumerable<T>, TResult>)

Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key.
C#
public static Vector<TResult> GroupBy<T, TKey, TResult>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<TKey, IEnumerable<T>, TResult> resultSelector
)

Parameters

vector  Vector<T>
A vector whose elements to group.
keySelector  Func<T, TKey>
A function to extract the key for each element.
resultSelector  Func<TKey, IEnumerable<T>, TResult>
A function that maps each group to a final result.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the keys.
TResult
The type of the final result for each group.

Return Value

Vector<TResult>
A vector of elements of type TResult where each element is obtained by applying resultSelector to each group resulting from using keySelector to obtain the key on each element of vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

GroupBy<R, C, TKey, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>, IEqualityComparer<TKey>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static Vector<TResult> GroupBy<R, C, TKey, TResult>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult> resultSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
resultSelector  Func<TKey, IEnumerable<DataFrameRow<R, C>>, TResult>
A function that maps a group with key of type TKey and a collection of data frame rows to a value of type TResult.
comparer  IEqualityComparer<TKey>
A comparer for keys.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TResult
The element type of the result.

Return Value

Vector<TResult>
A vector containing the result of applying resultSelector to each group of rows in frame where keys are evaluated using keySelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<R, C, TKey, TElement>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, IEqualityComparer<TKey>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static LinqExtensions.Lookup<TKey, TElement> GroupBy<R, C, TKey, TElement>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<DataFrameRow<R, C>, TElement> elementSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
elementSelector  Func<DataFrameRow<R, C>, TElement>
A function that maps a row of the data frame to a value of type TElement.
comparer  IEqualityComparer<TKey>
A comparer for keys.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TElement
The type of the elements of each group.

Return Value

LinqExtensions.Lookup<TKey, TElement>
A LinqExtensions.Lookup<TKey, T> containing the groupings of rows in frame where group membership is determined by applying comparer to the result of applying keySelector to each row.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<R, C, TKey, TElement, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static Vector<TResult> GroupBy<R, C, TKey, TElement, TResult>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<DataFrameRow<R, C>, TElement> elementSelector,
	Func<TKey, IEnumerable<TElement>, TResult> resultSelector
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
elementSelector  Func<DataFrameRow<R, C>, TElement>
A function that maps rows in the data frame to a value of type TElement.
resultSelector  Func<TKey, IEnumerable<TElement>, TResult>
A function that maps a group with key of type TKey and elements of type TElement to a value of type TResult.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TElement
The type of the elements of the groups.
TResult
The element type of the result.

Return Value

Vector<TResult>
A vector containing the result of applying resultSelector to each group of rows in frame where keys are evaluated using keySelector and values are evaluated using elementSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

GroupBy<T, TKey, TElement>(Vector<T>, Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>)

Groups the elements of a vector according to the specified key selector and element selector functions, and key comparer.
C#
public static LinqExtensions.Lookup<TKey, TElement> GroupBy<T, TKey, TElement>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<T, TElement> elementSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

vector  Vector<T>
The vector to create a lookup from.
keySelector  Func<T, TKey>
A function to extract a key from each element.
elementSelector  Func<T, TElement>
A function that transforms each input element.
comparer  IEqualityComparer<TKey>
An object that compares two keys for equality.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the key returned by the key selector.
TElement
The type of the value returned by the element selector.

Return Value

LinqExtensions.Lookup<TKey, TElement>
A lookup that contains keys and values selected from the input using elementSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

GroupBy<T, TKey, TResult>(Vector<T>, Func<T, TKey>, Func<TKey, IEnumerable<T>, TResult>, IEqualityComparer<TKey>)

Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. Key values are compared using the specified comparer.
C#
public static Vector<TResult> GroupBy<T, TKey, TResult>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<TKey, IEnumerable<T>, TResult> resultSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

vector  Vector<T>
A vector whose elements to group.
keySelector  Func<T, TKey>
A function to extract the key for each element.
resultSelector  Func<TKey, IEnumerable<T>, TResult>
A function that maps each group to a final result.
comparer  IEqualityComparer<TKey>
An object that compares two keys for equality.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the keys.
TResult
The type of the final result for each group.

Return Value

Vector<TResult>
A vector of elements of type TResult where each element is obtained by applying resultSelector to each group resulting from using keySelector to obtain the key on each element of vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

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

Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. The elements of each group are projected using the specified function.
C#
public static Vector<TResult> GroupBy<T, TKey, TElement, TResult>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<T, TElement> elementSelector,
	Func<TKey, IEnumerable<TElement>, TResult> resultSelector
)

Parameters

vector  Vector<T>
A vector whose elements to group.
keySelector  Func<T, TKey>
A function to extract the key for each element.
elementSelector  Func<T, TElement>
A function that maps each input element to an element in a grouping.
resultSelector  Func<TKey, IEnumerable<TElement>, TResult>
A function that maps each group to a final result.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the keys.
TElement
The type of the elements in each grouping.
TResult
The type of the final result for each group.

Return Value

Vector<TResult>
A vector of elements of type TResult where each element is obtained by applying resultSelector to each group resulting from using keySelector to obtain the key and elementSelector to obtain the values on each element of vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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).

GroupBy<R, C, TKey, TElement, TResult>(DataFrame<R, C>, Func<DataFrameRow<R, C>, TKey>, Func<DataFrameRow<R, C>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>)

Groups the rows of a data frame based on the specified key selector, and returns the result of applying a function to the selected elements of each group.
C#
public static Vector<TResult> GroupBy<R, C, TKey, TElement, TResult>(
	this DataFrame<R, C> frame,
	Func<DataFrameRow<R, C>, TKey> keySelector,
	Func<DataFrameRow<R, C>, TElement> elementSelector,
	Func<TKey, IEnumerable<TElement>, TResult> resultSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

frame  DataFrame<R, C>
A data frame.
keySelector  Func<DataFrameRow<R, C>, TKey>
A function that maps rows in the data frame to a key of type TKey.
elementSelector  Func<DataFrameRow<R, C>, TElement>
A function that maps rows in the data frame to a value of type TElement.
resultSelector  Func<TKey, IEnumerable<TElement>, TResult>
A function that maps a group with key of type TKey and elements of type TElement to a value of type TResult.
comparer  IEqualityComparer<TKey>
A comparer for keys.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TKey
The type of the key of the groups.
TElement
The type of the elements of the groups.
TResult
The element type of the result.

Return Value

Vector<TResult>
A vector containing the result of applying resultSelector to each group of rows in frame where group membership is determined by applying comparer to the result of applying keySelector to each row, and values are evaluated using elementSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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).

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

Groups the elements of a vector according to the specified key selector function and creates a result value from each group and its key. Key values are compared using the specified comparer, and the elements of each group are projected using the specified function.
C#
public static Vector<TResult> GroupBy<T, TKey, TElement, TResult>(
	this Vector<T> vector,
	Func<T, TKey> keySelector,
	Func<T, TElement> elementSelector,
	Func<TKey, IEnumerable<TElement>, TResult> resultSelector,
	IEqualityComparer<TKey> comparer
)

Parameters

vector  Vector<T>
A vector whose elements to group.
keySelector  Func<T, TKey>
A function to extract the key for each element.
elementSelector  Func<T, TElement>
A function that maps each input element to an element in a grouping.
resultSelector  Func<TKey, IEnumerable<TElement>, TResult>
A function that maps each group to a final result.
comparer  IEqualityComparer<TKey>
An object that compares two keys for equality.

Type Parameters

T
The type of the elements of the vector.
TKey
The type of the keys.
TElement
The type of the elements in each grouping.
TResult
The type of the final result for each group.

Return Value

Vector<TResult>
A vector of elements of type TResult where each element is obtained by applying resultSelector to each group resulting from using keySelector to obtain the key and elementSelector to obtain the values on each element of vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<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