public static IAsyncObservable <TResult> ToAsyncObservable <TResult>(this Task <TResult> task) { if (task == null) { throw new ArgumentNullException(nameof(task)); } return(AsyncObservable.Create <TResult>(observer => task.AcceptAsync(observer))); }
public static IAsyncObservable <Unit> ToAsyncObservable(this Task task, IAsyncScheduler scheduler) { if (task == null) { throw new ArgumentNullException(nameof(task)); } if (scheduler == null) { throw new ArgumentNullException(nameof(scheduler)); } return(AsyncObservable.Create <Unit>(observer => task.AcceptAsync(observer, scheduler))); }