Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/10 02:27:02 (14 years ago)
Author:
swagner
Message:

Refactored HeuristicLab.Collections (#977)

File:
1 edited

Legend:

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

    r3370 r3390  
    2424using System.Collections.Generic;
    2525using System.ComponentModel;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2726
    2827namespace HeuristicLab.Collections {
    2928  [Serializable]
    30   [StorableClass]
    3129  public class ObservableCollection<T> : IObservableCollection<T> {
    32     [Storable]
    3330    protected List<T> list;
    3431
    3532    #region Properties
    36     [Storable]
    37     private bool readOnlyView;
    38     public virtual bool ReadOnlyView {
    39       get { return readOnlyView; }
    40       set {
    41         if ((readOnlyView != value) && !((ICollection<T>)list).IsReadOnly) {
    42           readOnlyView = value;
    43           OnReadOnlyViewChanged();
    44           OnPropertyChanged("ReadOnlyView");
    45         }
    46       }
    47     }
    48 
    4933    public int Capacity {
    5034      get { return list.Capacity; }
     
    6751    public ObservableCollection() {
    6852      list = new List<T>();
    69       readOnlyView = ((ICollection<T>)list).IsReadOnly;
    7053    }
    7154    public ObservableCollection(int capacity) {
    7255      list = new List<T>(capacity);
    73       readOnlyView = ((ICollection<T>)list).IsReadOnly;
    7456    }
    7557    public ObservableCollection(IEnumerable<T> collection) {
    7658      list = new List<T>(collection);
    77       readOnlyView = ((ICollection<T>)list).IsReadOnly;
    7859    }
    7960    #endregion
     
    205186    #region Events
    206187    [field: NonSerialized]
    207     public event EventHandler ReadOnlyViewChanged;
    208     protected virtual void OnReadOnlyViewChanged() {
    209       EventHandler handler = ReadOnlyViewChanged;
    210       if (handler != null) handler(this, EventArgs.Empty);
    211     }
    212 
    213     [field: NonSerialized]
    214188    public event CollectionItemsChangedEventHandler<T> ItemsAdded;
    215189    protected virtual void OnItemsAdded(IEnumerable<T> items) {
Note: See TracChangeset for help on using the changeset viewer.