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);
					}
				}
			}
		}
Exemplo n.º 2
0
 void ICollection <KeyValuePair <TSecond, TFirst> > .Add(KeyValuePair <TSecond, TFirst> item)
 {
     _owner._secondToFirst.Add(item);
     _owner._firstToSecond.Add(item.Reverse());
 }
Exemplo n.º 3
0
 public void Add(KeyValuePair <TSecond, TFirst> item)
 {
     _owner._secondToFirst.Add(item);
     _owner._firstToSecond.Add(item.Reverse());
 }
Exemplo n.º 4
0
 void ICollection <KeyValuePair <TFirst, TSecond> > .Add(KeyValuePair <TFirst, TSecond> item)
 {
     _firstToSecond.Add(item);
     _secondToFirst.Add(item.Reverse());
 }
Exemplo n.º 5
0
 public void Add(KeyValuePair <TFirst, TSecond> item)
 {
     _firstToSecond.Add(item);
     _secondToFirst.Add(item.Reverse());
 }