Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/29/09 02:33:57 (14 years ago)
Author:
swagner
Message:

Implemented IDisposable and unified extension capabilities for all observable collections (#819)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableDictionary.cs

    r2574 r2575  
    8080    public ObservableDictionary(IDictionary<TKey, TValue> dictionary) {
    8181      dict = new Dictionary<TKey, TValue>(dictionary);
     82      OnItemsAdded(dictionary);
    8283    }
    8384    public ObservableDictionary(int capacity, IEqualityComparer<TKey> comparer) {
     
    8687    public ObservableDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer) {
    8788      dict = new Dictionary<TKey, TValue>(dictionary, comparer);
     89      OnItemsAdded(dictionary);
     90    }
     91    #endregion
     92
     93    #region Destructors
     94    ~ObservableDictionary() {
     95      Dispose(false);
     96    }
     97    protected virtual void Dispose(bool disposing) {
     98      if (disposing) {
     99        Clear();
     100      }
     101    }
     102    public void Dispose() {
     103      Dispose(true);
     104      GC.SuppressFinalize(this);
    88105    }
    89106    #endregion
Note: See TracChangeset for help on using the changeset viewer.