BulkObservableCollection.cs 623 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Collections.Specialized;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace MeterVision.Helper
  9. {
  10. public class BulkObservableCollection<T> : ObservableCollection<T>
  11. {
  12. public void AddRange(IEnumerable<T> items)
  13. {
  14. foreach (var item in items)
  15. {
  16. Items.Add(item);
  17. }
  18. OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
  19. }
  20. }
  21. ///-----------------------
  22. }