/// <summary> /// Fired the Removed event for the given item /// </summary> /// <param name="item">The item that was removed</param> internal void FireRemoved(T item) { Removed.Fire(item); Changed.Fire(); var itemLifetime = membershipLifetimes[item]; membershipLifetimes.Remove(item); itemLifetime.Dispose(); }
/// <summary> /// Removes all items from the collection /// </summary> public void Clear() { if (Removed.HasSubscriptions) { var items = wrapped.ToArray(); wrapped.Clear(); foreach (var item in items) { Removed.Fire(item); } } else { wrapped.Clear(); } }