예제 #1
0
 public void Remove(T1 key)
 {
     if (KeyToValue.TryGetValue(key, out T2 value))
     {
         KeyToValue.Remove(key);
         ValueToKey.Remove(value);
     }
 }
예제 #2
0
 public void Remove(T2 value)
 {
     if (ValueToKey.TryGetValue(value, out T1 key))
     {
         ValueToKey.Remove(value);
         KeyToValue.Remove(key);
     }
 }
예제 #3
0
 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;
         }
     }
 }