using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
namespace XFEWorkflow.Core.Utilities;
/// <summary>Publishes a prepared snapshot with one collection notification.</summary>
public sealed class BulkObservableCollection<T> : ObservableCollection<T>
{
public void ReplaceAll(IReadOnlyList<T> 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));
}
}
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
namespace XFEWorkflow.Core.Utilities;
/// <summary>Publishes a prepared snapshot with one collection notification.</summary>
public sealed class BulkObservableCollection<T> : ObservableCollection<T>
{
public void ReplaceAll(IReadOnlyList<T> 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));
}
}