Example #1
0
        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)));
        }
Example #2
0
        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)));
        }