Esempio n. 1
0
 public static IReactiveDictionary <TKey, TValue> SubscribeMany <TKey, TValue>(this IReactiveDictionary <TKey, TValue> dict, Func <TValue, IDisposable> subscriptionFactory)
 {
     return(dict.SubscribeMany((_, value) => subscriptionFactory(value)));
 }
Esempio n. 2
0
 public static IObservable <KeyValuePair <TKey, TValue> > ElementsAddedOrUpdated <TKey, TValue>(this IReactiveDictionary <TKey, TValue> dict)
 {
     return(dict
            .AsObservable()
            .Select(x => x.Where(y => y.ChangeReason == ReactiveDictionaryChangeReason.AddOrUpdate))
            .SelectMany(x => x)
            .Select(x => new KeyValuePair <TKey, TValue>(x.Key, x.Value)));
 }
Esempio n. 3
0
 public static bool ContainsKey <TKey, TValue>(this IReactiveDictionary <TKey, TValue> dict, TKey key)
 {
     return(dict.TryGetValue(key, out _));
 }
Esempio n. 4
0
 public static ICollectedReactiveDictionary <TKey, TNewValue> Select <TKey, TValue, TNewValue>(
     this IReactiveDictionary <TKey, TValue> dict,
     Func <TValue, TNewValue> selector)
 {
     return(dict.Select((_, value) => selector(value)));
 }
Esempio n. 5
0
 public static ICollectedReactiveDictionary <TKey, TNewValue> Select <TKey, TValue, TNewValue>(
     this IReactiveDictionary <TKey, TValue> dict,
     Func <TKey, TValue, TNewValue> selector)
 {
     return(new SelectingDictionary <TKey, TValue, TNewValue>(dict, selector, new Dictionary <TKey, TNewValue>()));
 }
Esempio n. 6
0
 public static IReactiveDictionary <TKey, TNewValue> SelectEquatable <TKey, TValue, TNewValue>(
     this IReactiveDictionary <TKey, TValue> dict,
     Func <TValue, TNewValue> selector) where TNewValue : IEquatable <TNewValue>
 {
     return(dict.SelectEquatable((_, value) => selector(value)));
 }