public bool Remove(TK key) { if (!myStorage.TryGetValue(key, out var value)) { return(false); } myStorage.Remove(key); myChange.Fire(MapEvent <TK, TV> .Remove(key, value)); return(true); }
public void Clear() { var changes = new List <MapEvent <TK, TV> >(Count); changes.AddRange(myStorage.Select(kv => MapEvent <TK, TV> .Remove(kv.Key, kv.Value))); myStorage.Clear(); foreach (var change in changes) { myChange.Fire(change); } }
public bool Remove(K key) { V value; if (!myMap.TryGetValue(key, out value)) { return(false); } myMap.Remove(key); myChange.Fire(MapEvent <K, V> .Remove(key, value)); return(true); }