public void Dispose() { using(@lock.ForWriting()) { var burdens = new KeyValuePair<object, Burden>[instance2Burden.Count]; instance2Burden.CopyTo(burdens, 0); // NOTE: This is relying on a undocumented behavior that order of items when enumerating Dictionary<> will be oldest --> latest foreach (var burden in burdens.Reverse()) { if (instance2Burden.ContainsKey(burden.Key)) { burden.Value.Release(this); instance2Burden.Remove(burden.Key); } } } }
void ICollection <KeyValuePair <TSecond, TFirst> > .Add(KeyValuePair <TSecond, TFirst> item) { _owner._secondToFirst.Add(item); _owner._firstToSecond.Add(item.Reverse()); }
public void Add(KeyValuePair <TSecond, TFirst> item) { _owner._secondToFirst.Add(item); _owner._firstToSecond.Add(item.Reverse()); }
void ICollection <KeyValuePair <TFirst, TSecond> > .Add(KeyValuePair <TFirst, TSecond> item) { _firstToSecond.Add(item); _secondToFirst.Add(item.Reverse()); }
public void Add(KeyValuePair <TFirst, TSecond> item) { _firstToSecond.Add(item); _secondToFirst.Add(item.Reverse()); }