Linq Extensions.Group By<T, TKey, TElement, TResult>(Vector<T>, Func<T, TKey>, Func<T, TElement>, Func<TKey, IEnumerable<TElement>, TResult>) 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.
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#
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.
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
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.