public new void Remove(TKey key) { bool bContains = ContainsKey(TransformKey(key)); if (m_bThrowErrorOnInvalidRemove && !bContains) { throw new IndexedDictionaryException("Key does not exist within the Dictionary"); } else if (!bContains) { return; } // Raise before events: DictionaryBeforeEventArgs <TKey, TValue> e = new DictionaryBeforeEventArgs <TKey, TValue> (key, base[TransformKey(key)]); // Raise before events: bool bubble = true; if (BeforeRemove != null) { foreach (DictionaryBeforeDelegate <TKey, TValue> function in BeforeRemove.GetInvocationList()) { e.Bubble = true; function.Invoke(this, e); bubble = bubble && e.Bubble; } } if (!bubble) { return; } // Remove item: // Use value returend by event: m_col.Remove(e.Key); base.Remove(TransformKey(e.Key)); // Raise after events: if (AfterRemove != null) { AfterRemove.Invoke(this, e); } }
/// <summary> /// Raises the <see cref="AfterRemove"/> event. /// </summary> /// <param name="args">Event arguments.</param> protected void HandleAfterRemove(AfterModifyEventArgs <TItem> args) { AfterRemove?.Invoke(this, args); }