public void Remove(T1 key) { if (KeyToValue.TryGetValue(key, out T2 value)) { KeyToValue.Remove(key); ValueToKey.Remove(value); } }
public void Remove(T2 value) { if (ValueToKey.TryGetValue(value, out T1 key)) { ValueToKey.Remove(value); KeyToValue.Remove(key); } }
public T2 this[T1 key] { get { return(KeyToValue[key]); } set { T2 oldValue = KeyToValue[key]; if (!oldValue.Equals(value)) { ValueToKey.Remove(oldValue); KeyToValue[key] = value; ValueToKey[value] = key; } } }