/// <summary> /// Attempt to remove a key / value pair from the dictionary. /// </summary> /// <param name="item"> /// The key / value pair to remove. /// </param> /// <returns> /// <c>true</c>, if the key / value pair was removed; otherwise, <c>false</c>. /// </returns> public bool Remove(KeyValuePair <T3, T4> item) { if (!ForwardLookup.Remove(item)) { return(false); } ReverseLookup.Remove(new KeyValuePair <T4, T3>( key: item.Value, value: item.Key )); return(true); }
/// <summary> /// Attempt to remove a value from the dictionary. /// </summary> /// <param name="key"> /// The key of the value to remove. /// </param> /// <returns> /// <c>true</c>, if the value was removed; otherwise, <c>false</c>. /// </returns> public bool Remove(T3 key) { T4 value; if (!ForwardLookup.TryGetValue(key, out value)) { return(false); } ForwardLookup.Remove(key); ReverseLookup.Remove(value); return(true); }