groupSelectValueE<TKey, TValue, TResult> method

Enumerable<TResult> groupSelectValueE <TKey, TValue, TResult>(Selector<T, TKey> keySelector, Selector<T, TValue> valueSelector, GroupSelector<TKey, Iterable<TValue>, TResult> resultSelector, { EqualityComparer<TKey> keyComparer })

Groups the elements in the enumerable by a key, maps the elements to a new value, and maps the groups to a new element.

After applying the groupSelectValueE 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 stored as a value obtained by passing the elements to the valueSelector 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 groupSelectValueE method will use the comparer and hasher properties in order to determine equivalency. If omitted, groupSelectValueE will resort to strict equivalency (i.e. checking if (value == element)).

(For the groupSelectValueE method, only the comparer and hasher properties of the EqualityComparer need be supplied.)

Implementation

Enumerable<TResult> groupSelectValueE<TKey, TValue, TResult>(
    Selector<T, TKey> keySelector,
    Selector<T, TValue> valueSelector,
    GroupSelector<TKey, Iterable<TValue>, TResult> resultSelector,
    {EqualityComparer<TKey> keyComparer}) {
  ArgumentError.checkNotNull(keySelector);
  ArgumentError.checkNotNull(valueSelector);
  ArgumentError.checkNotNull(resultSelector);
  return GroupSelectValueEnumerable<T, TKey, TValue, TResult>(
      this, keySelector, valueSelector, resultSelector, keyComparer);
}