Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2573


Ignore:
Timestamp:
12/27/09 04:12:00 (14 years ago)
Author:
swagner
Message:

Worked on HeuristicLab.Collections plugin (#819)

  • added ObservableKeyedCollectionBase
  • minor fixes
Location:
trunk/sources/HeuristicLab.Collections/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Collections/3.3/HeuristicLab.Collections-3.3.csproj

    r2572 r2573  
    4949  </ItemGroup>
    5050  <ItemGroup>
     51    <Compile Include="ObservableKeyedCollectionBase.cs" />
    5152    <Compile Include="IndexedCollectionChangedEventsBase.cs" />
    5253    <Compile Include="ObservableCollection.cs" />
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableCollection.cs

    r2572 r2573  
    9797    }
    9898    public void RemoveRange(IEnumerable<T> collection) {
     99      if (collection == null) throw new ArgumentNullException();
    99100      List<T> items = new List<T>();
    100101      foreach (T item in collection) {
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableDictionary.cs

    r2572 r2573  
    5656      }
    5757      set {
    58         KeyValuePair<TKey, TValue> item = new KeyValuePair<TKey, TValue>(key, dict[key]);
    59         dict[key] = value;
    60         OnItemsReplaced(new KeyValuePair<TKey, TValue>[] { new KeyValuePair<TKey, TValue>(key, value) }, new KeyValuePair<TKey, TValue>[] { item });
     58        if (dict.ContainsKey(key)) {
     59          KeyValuePair<TKey, TValue> item = new KeyValuePair<TKey, TValue>(key, dict[key]);
     60          dict[key] = value;
     61          OnItemsReplaced(new KeyValuePair<TKey, TValue>[] { new KeyValuePair<TKey, TValue>(key, value) }, new KeyValuePair<TKey, TValue>[] { item });
     62        } else {
     63          dict[key] = value;
     64          OnItemsAdded(new KeyValuePair<TKey, TValue>[] { new KeyValuePair<TKey, TValue>(key, value) });
     65        }
    6166      }
    6267    }
     
    9499      return dict.Contains(item);
    95100    }
     101
    96102    public bool TryGetValue(TKey key, out TValue value) {
    97103      return dict.TryGetValue(key, out value);
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableList.cs

    r2572 r2573  
    184184    }
    185185    public int RemoveAll(Predicate<T> match) {
     186      if (match == null) throw new ArgumentNullException();
    186187      List<IndexedItem<T>> items = new List<IndexedItem<T>>();
    187188      for (int i = 0; i < list.Count; i++) {
Note: See TracChangeset for help on using the changeset viewer.