using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; namespace Umbraco.Core.Collections { /// /// Allows clearing all event handlers /// /// public class EventClearingObservableCollection : ObservableCollection { public EventClearingObservableCollection() { } public EventClearingObservableCollection(List list) : base(list) { } public EventClearingObservableCollection(IEnumerable collection) : base(collection) { } // need to override to clear public override event NotifyCollectionChangedEventHandler CollectionChanged; /// /// Clears all event handlers for the event /// public void ClearCollectionChangedEvents() => CollectionChanged = null; } }