Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/05/20 05:46:07 (4 years ago)
Author:
abeham
Message:

#2521: completed port of VRP (needs testing though)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Collections/3.3/ObservableSet.cs

    r17226 r17718  
    128128        OnItemsRemoved(items);
    129129      }
     130    }
     131
     132    /// <summary>
     133    /// Performs a Clear and an Add, but does not fire separate events for those operations
     134    /// </summary>
     135    /// <param name="other"></param>
     136    public void Replace(IEnumerable<T> other) {
     137      List<T> oldItems = null;
     138      if (set.Any()) oldItems = new List<T>(set);
     139      else oldItems = new List<T>();
     140
     141      set.Clear();
     142      set.UnionWith(other);
     143
     144      List<T> items = null;
     145      if (set.Any()) items = new List<T>(set);
     146      else items = new List<T>();
     147
     148      OnCollectionReset(items, oldItems);
     149      if (oldItems.Count != items.Count) OnPropertyChanged("Count");
    130150    }
    131151
Note: See TracChangeset for help on using the changeset viewer.