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.
Namespace:
Extreme.DataAnalysis.Linq
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
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
)
<ExtensionAttribute>
Public Shared Function GroupBy(Of T, TKey, TElement, TResult) (
vector As Vector(Of T),
keySelector As Func(Of T, TKey),
elementSelector As Func(Of T, TElement),
resultSelector As Func(Of TKey, IEnumerable(Of TElement), TResult),
comparer As IEqualityComparer(Of TKey)
) As Vector(Of TResult)
public:
[ExtensionAttribute]
generic<typename T, typename TKey, typename TElement, typename TResult>
static Vector<TResult>^ GroupBy(
Vector<T>^ vector,
Func<T, TKey>^ keySelector,
Func<T, TElement>^ elementSelector,
Func<TKey, IEnumerable<TElement>^, TResult>^ resultSelector,
IEqualityComparer<TKey>^ comparer
)
[<ExtensionAttribute>]
static member GroupBy :
vector : Vector<'T> *
keySelector : Func<'T, 'TKey> *
elementSelector : Func<'T, 'TElement> *
resultSelector : Func<'TKey, IEnumerable<'TElement>, 'TResult> *
comparer : IEqualityComparer<'TKey> -> Vector<'TResult>
Parameters
- vector
- Type: Extreme.MathematicsVectorT
A vector whose elements to group. - keySelector
- Type: SystemFuncT, TKey
A function to extract the key for each element. - elementSelector
- Type: SystemFuncT, TElement
A function that maps each input element to an
element in a grouping. - resultSelector
- Type: SystemFuncTKey, IEnumerableTElement, TResult
A function that maps each group to a final result. - comparer
- Type: System.Collections.GenericIEqualityComparerTKey
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
Type:
VectorTResultA 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
VectorT. 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).
Reference