LinqExtensions.GroupBy<T, TKey, TResult>(Vector<T>, Func<T, TKey>, Func<TKey, IEnumerable<T>, 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.

Definition

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

See Also