Пример #1
0
 public ObservableIndex(TComparer comparer, IReadOnlyIndexed <TKey, TValue> outer = null)
 {
     _inner     = outer != null ? new DictionarySlim <TKey, TValue, TComparer>(outer, comparer) : new DictionarySlim <TKey, TValue, TComparer>(comparer);
     _observers = new WeakCollection <IObserver <ObservableEvent <TValue> > >();
     if (outer is IObservable <ObservableEvent <TValue> > observableDictionary)
     {
         observableDictionary.Subscribe(this);
     }
 }
Пример #2
0
        public DictionarySlim(DictionarySlim <TKey, TValue, TComparer> other)
        {
            _comparer = other._comparer;
            _buckets  = new int[other._buckets.Length];
            _entries  = new Entry[other._entries.Length];

            var enumerator = new Enumerator(other);

            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                AddOrReplace(current.Key, current.Value);
            }
        }
Пример #3
0
 public LookupSlim(TComparer comparer)
 {
     _comparer = comparer;
     _inner    = new DictionarySlim <TKey, TValue, TComparer>(comparer);
 }
Пример #4
0
 public CascadeIndex(TComparer comparer)
 {
     Outer  = null;
     _inner = new DictionarySlim <TKey, TValue, TComparer>(comparer);
 }