Пример #1
0
 public WeakKeyReference(T key, WeakKeyComparer <T> comparer)
     : base(key)
 {
     // retain the object's hash code immediately so that even
     // if the target is GC'ed we will be able to find and
     // remove the dead weak reference.
     this.HashCode = comparer.GetHashCode(key);
 }
Пример #2
0
 public WeakKeyDictionary(int capacity, IEqualityComparer <TKey> comparer)
 {
     this.comparer   = new WeakKeyComparer <TKey>(comparer);
     this.dictionary = new Dictionary <object, TValue>(capacity, this.comparer);
 }