Пример #1
0
        public static IAsyncObservable <Decimal> Average(this IAsyncObservable <Decimal> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(Create <Decimal>(observer => source.SubscribeSafeAsync(AsyncObserver.AverageDecimal(observer))));
        }
Пример #2
0
        public static IAsyncObservable <Decimal> Average <TSource>(this IAsyncObservable <TSource> source, Func <TSource, Task <Decimal> > selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

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