예제 #1
0
        public static IAsyncObservable <Single> Average(this IAsyncObservable <Single> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(Create <Single>(observer => source.SubscribeSafeAsync(AsyncObserver.AverageSingle(observer))));
        }
예제 #2
0
        public static IAsyncObservable <Single> Average <TSource>(this IAsyncObservable <TSource> source, Func <TSource, Task <Single> > selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(Create <Single>(observer => source.SubscribeSafeAsync(AsyncObserver.AverageSingle(observer, selector))));
        }