groupSelectE<TKey, TResult> method
Groups the elements in the enumerable by a key and maps the groups to a new element.
After applying the groupSelectE method to an enumerable, the resulting
enumerable will be a series of groups of elements. Each group will consist
of all elements in the source enumerable that share a common key as defined
by passing the element to the keySelector
function. Finally, each group
will then be passed to the resultSelector
function along with its
associated key and the returned value of that function will be returned as
an element of the resulting enumerable.
Optionally, an EqualityComparer can be supplied to handle key comparisons.
If one is provided, the groupSelectE method will use the comparer
and
hasher
properties in order to determine equivalency. If omitted,
groupSelectE will resort to strict equivalency (i.e. checking if
(value == element)
).
(For the groupSelectE method, only the comparer
and hasher
properties of
the EqualityComparer need be supplied.)
Implementation
Enumerable<TResult> groupSelectE<TKey, TResult>(Selector<T, TKey> keySelector,
GroupSelector<TKey, Iterable<T>, TResult> resultSelector,
{EqualityComparer<TKey> keyComparer}) {
ArgumentError.checkNotNull(keySelector);
ArgumentError.checkNotNull(resultSelector);
return GroupSelectEnumerable<T, TKey, TResult>(
this, keySelector, resultSelector, keyComparer);
}