public static IObservable <int> Count <T>(this IReactiveSet <T> set)
        {
            if (set == null)
            {
                throw new ArgumentNullException(nameof(set));
            }

            return(set.Aggregate(0, (x, _) => x + 1, (x, _) => x - 1));
        }
        public static IObservable <int> Product(this IReactiveSet <int> set)
        {
            if (set == null)
            {
                throw new ArgumentNullException(nameof(set));
            }

            return(set.Aggregate(1, (x, y) => x * y, (x, y) => x / y));
        }
示例#3
0
        private static IObservable <IImmutableSet <T> > ToImmutableSets <T>(this IReactiveSet <T> set, Func <IImmutableSet <T> > setFactory)
        {
            if (set == null)
            {
                throw new ArgumentNullException(nameof(set));
            }
            if (setFactory == null)
            {
                throw new ArgumentNullException(nameof(setFactory));
            }

            return(set.Aggregate(ImmutableHashSet <T> .Empty, (x, y) => x.Add(y), (x, y) => x.Remove(y)));
        }
示例#4
0
 public static IObservable <ImmutableSortedSet <T> > ToImmutableSortedSets <T>(this IReactiveSet <T> set)
 {
     return(set.Aggregate(ImmutableSortedSet <T> .Empty, (x, y) => x.Add(y), (x, y) => x.Remove(y)));
 }