Esempio n. 1
0
        public static IAsyncObservable <TSource> Aggregate <TSource>(this IAsyncObservable <TSource> source, Func <TSource, TSource, ValueTask <TSource> > func)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (func == null)
            {
                throw new ArgumentNullException(nameof(func));
            }

            return(Create <TSource>(observer => source.SubscribeSafeAsync(AsyncObserver.Aggregate(observer, func))));
        }
Esempio n. 2
0
        public static IAsyncObservable <TResult> Aggregate <TSource, TAccumulate, TResult>(this IAsyncObservable <TSource> source, TAccumulate seed, Func <TAccumulate, TSource, Task <TAccumulate> > func, Func <TAccumulate, Task <TResult> > resultSelector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (resultSelector == null)
            {
                throw new ArgumentNullException(nameof(resultSelector));
            }
            if (func == null)
            {
                throw new ArgumentNullException(nameof(func));
            }

            return(Create <TResult>(observer => source.SubscribeSafeAsync(AsyncObserver.Aggregate(observer, seed, func, resultSelector))));
        }