using System.Collections.ObjectModel; using System.Collections.Specialized; namespace Daybreak.Shared.Models; public class BatchedObservableCollection : ObservableCollection { public void RemoveBatch(IEnumerable values) { this.CheckReentrancy(); var changed = false; foreach (var value in values) { this.Items.Remove(value); changed = true; } if (!changed) { return; } this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } public void AddBatch(IEnumerable values) { this.CheckReentrancy(); var changed = false; foreach (var value in values) { this.Items.Add(value); } if (!changed) { return; } this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }