/// <inheritdoc/> public void Add(TKey key, TValue value) { Contract.Require(key, nameof(key)); var weakKey = new WeakKeyReference <TKey>(key, this.comparer); this.dictionary.Add(weakKey, value); }
/// <inheritdoc/> public TValue this[TKey key] { get { Contract.Require(key, nameof(key)); var weakKey = new WeakKeyReference <TKey>(key, this.comparer); return(this.dictionary[weakKey]); } set { Contract.Require(key, nameof(key)); var weakKey = new WeakKeyReference <TKey>(key, this.comparer); this.dictionary[weakKey] = value; } }