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

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.

Definition

Namespace: Extreme.DataAnalysis.Linq
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
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