Beispiel #1
0
        public static IAsyncObservable <IGroupedAsyncObservable <TKey, TElement> > GroupBy <TSource, TKey, TElement>(this IAsyncObservable <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementSelector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException(nameof(keySelector));
            }
            if (elementSelector == null)
            {
                throw new ArgumentNullException(nameof(elementSelector));
            }

            return(Create <IGroupedAsyncObservable <TKey, TElement> >(observer => GroupByCore(source, observer, (o, d) => AsyncObserver.GroupBy(o, d, keySelector, elementSelector))));
        }
Beispiel #2
0
        public static IAsyncObservable <IGroupedAsyncObservable <TKey, TSource> > GroupBy <TSource, TKey>(this IAsyncObservable <TSource> source, Func <TSource, TKey> keySelector, int capacity, IEqualityComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException(nameof(keySelector));
            }
            if (capacity < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(capacity));
            }
            if (comparer == null)
            {
                throw new ArgumentNullException(nameof(comparer));
            }

            return(Create <IGroupedAsyncObservable <TKey, TSource> >(observer => GroupByCore(source, observer, (o, d) => AsyncObserver.GroupBy(o, d, keySelector, capacity, comparer))));
        }