Exemplo n.º 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);
 }
Exemplo n.º 2
0
 public WeakDictionary(int capacity, IEqualityComparer <TKey> comparer)
 {
     this.comparer   = new WeakKeyComparer <TKey>(comparer);
     this.dictionary = new Dictionary <object, WeakReference <TValue> >(capacity, this.comparer);
 }