Observable for awaitable method C#

c#, system.reactive

Solution

You can create an `IObservable<T>` from a `Task<T>` using ToObservable:

using System.Reactive.Threading.Tasks;

Stream s = ...;
IObservable<int> o = s.ReadAsync(buffer, offset, count).ToObservable();

Problem

Observable.FromAsyncPattern can be used to make an observable from BeginX EndX style async methods. Maybe I'm misunderstanding things, but is there a similar function to create an observable from the new async style methods - ie.. Stream.ReadAsync?

Original source