System.Interactive.dll includes a For()
method with the following implementation:
IEnumerable<TResult> For<TSource, TResult>(
IEnumerable<TSource> source,
Func<TSource, IEnumerable<TResult>> resultSelector)
{
return source.Select<TSource, IEnumerable<TResult>>(resultSelector).Concat<TResult>();
}
Am I missing something or is this equivalent to the existing Enumerable.SelectMany()
, minus this
?
IEnumerable<TResult> SelectMany<TSource, TResult>(
this IEnumerable<TSource> source,
Func<TSource, IEnumerable<TResult>> selector)