SelectMany<TResult> method

Enumerable<TResult> SelectMany <TResult>(ManySelector<T, TResult> selector)

Maps elements in an enumerable to collections and then flattens those collections into a single enumerable.

During iteration, the selector function is applied to each element. The returned collection of that function is then iterated over, and each value in that iteration is provided as the next element of the resulting enumerable. The result is all the collections flattened so that their values become elements in a single enumerable.

Implementation

Enumerable<TResult> SelectMany<TResult>(ManySelector<T, TResult> selector) {
  assert(selector != null);

  return SelectManyEnumerable<T, TResult>(this, selector);
}