/// <summary> /// Remove all the elements that have the given key /// </summary> public void Remove(TK key) { lock (_lock) { AllItems.RemoveAll(v => v.Key.Equals(key)); if (SingleItems.ContainsKey(key)) { SingleItems.Remove(key); } else { RepeatedItems.Remove(key); } } }
/// <summary> /// Removes a specific value /// </summary> public void Remove(CfgNodeValue <TK, TV> keyVal) { lock (_lock) { AllItems.RemoveAll(v => v.Value.Equals(keyVal)); if (SingleItems.ContainsKey(keyVal.Key)) { SingleItems.Remove(keyVal.Key); } else if (RepeatedItems.ContainsKey(keyVal.Key)) { RepeatedItems[keyVal.Key].RemoveAll(v => v.Equals(keyVal)); if (!RepeatedItems[keyVal.Key].Any()) { RepeatedItems.Remove(keyVal.Key); } } } }
public void RemoveSelected() { AllItems.RemoveAll(item => SelectedItems.Contains(item)); SelectedItems.Clear(); }