using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; namespace XFEWorkflow.Core.Utilities; /// Publishes a prepared snapshot with one collection notification. public sealed class BulkObservableCollection : ObservableCollection { public void ReplaceAll(IReadOnlyList values) { CheckReentrancy(); Items.Clear(); foreach (var value in values) Items.Add(value); OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count))); OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }