Good question. They give the same results, but the internal implementations are completely different.
EnumerableEx.For would be added to System.Interactive to maintain the duality between IObservable and IEnumerables. Note: Observable.For and Observable.SelectMany are different:
IObservable<TResult> For<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector)
against.
IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector)
Therefore, you expect EnumerableEx.For to have this signature, and not the one that actually has:
IEnumerable<TResult> For<TSource, TResult>(**IObservable**<TSource> source, Func<TSource, IEnumerable<TResult>> resultSelector)
However, obviously, it does not use the IObservable source. Perhaps it was intended. I would ask your question on the Rx forums to find out if the Rx team has an answer.
Richard Hein
source share