Exemple #1
0
 public void InsertRange(int index, ReadOnlySpan <T> items)
 {
     lock (SyncRoot)
     {
         using (var xs = new CloneCollection <T>(items))
         {
             list.InsertRange(index, xs.AsEnumerable());
             CollectionChanged?.Invoke(NotifyCollectionChangedEventArgs <T> .Add(xs.Span, index));
         }
     }
 }
Exemple #2
0
 public void AddRange(IEnumerable <T> items)
 {
     lock (SyncRoot)
     {
         var index = list.Count;
         using (var xs = new CloneCollection <T>(items))
         {
             // to avoid iterate twice, require copy before insert.
             list.AddRange(xs.AsEnumerable());
             CollectionChanged?.Invoke(NotifyCollectionChangedEventArgs <T> .Add(xs.Span, index));
         }
     }
 }