コード例 #1
0
 public static IObservable <ImmutableSortedDictionary <TKey, TValue> > ToSortedImmutableDictionaries <TKey, TValue>(this IReactiveDictionary <TKey, TValue> dict)
 {
     return(dict.Aggregate(
                ImmutableSortedDictionary <TKey, TValue> .Empty,
                (result, key, value) => result.SetItem(key, value),
                (result, key, value) => result.Remove(key)
                ));
 }
コード例 #2
0
 public static IObservable <TResult> Aggregate <TKey, TValue, TResult>(
     this IReactiveDictionary <TKey, TValue> dict,
     TResult seed,
     Func <TResult, TValue, TResult> addFunc,
     Func <TResult, TValue, TResult> removeFunc)
 {
     return(dict.Aggregate(seed, (result, _, value) => addFunc(result, value), (result, _, value) => removeFunc(result, value)));
 }
コード例 #3
0
 public static IObservable <int> Count <TKey, TValue>(this IReactiveDictionary <TKey, TValue> dict)
 {
     return(dict.Aggregate(0, (total, _) => total + 1, (total, _) => total - 1));
 }