Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (13 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs

    r4419 r4722  
    4444    }
    4545
     46    [StorableConstructor]
     47    protected ReadOnlyItemCollection(bool deserializing) : base(deserializing) { }
     48    protected ReadOnlyItemCollection(ReadOnlyItemCollection<T> original, Cloner cloner) {
     49      cloner.RegisterClonedObject(original, this);
     50      collection = cloner.Clone((IItemCollection<T>)original.collection);
     51      RegisterEvents();
     52    }
    4653    public ReadOnlyItemCollection() : base(new ItemCollection<T>()) { }
    4754    public ReadOnlyItemCollection(IItemCollection<T> collection) : base(collection) { }
    48     [StorableConstructor]
    49     protected ReadOnlyItemCollection(bool deserializing) : base(deserializing) { }
    5055
    5156    public object Clone() {
     
    5358    }
    5459    public virtual IDeepCloneable Clone(Cloner cloner) {
    55       ReadOnlyItemCollection<T> clone = (ReadOnlyItemCollection<T>)Activator.CreateInstance(this.GetType());
    56       cloner.RegisterClonedObject(this, clone);
    57       clone.collection = (IItemCollection<T>)((IItemCollection<T>)collection).Clone(cloner);
    58       clone.RegisterEvents();
    59       return clone;
     60      return new ReadOnlyItemCollection<T>(this, cloner);
    6061    }
    6162
Note: See TracChangeset for help on using the changeset viewer.