Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 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/ReadOnlyItemDictionary.cs

    r4419 r4722  
    4747    }
    4848
     49    [StorableConstructor]
     50    protected ReadOnlyItemDictionary(bool deserializing) : base(deserializing) { }
     51    protected ReadOnlyItemDictionary(ReadOnlyItemDictionary<TKey, TValue> original, Cloner cloner) {
     52      cloner.RegisterClonedObject(original, this);
     53      dict = cloner.Clone((IItemDictionary<TKey, TValue>)original.dict);
     54      RegisterEvents();
     55    }
    4956    public ReadOnlyItemDictionary() : base(new ItemDictionary<TKey, TValue>()) { }
    5057    public ReadOnlyItemDictionary(IItemDictionary<TKey, TValue> dictionary) : base(dictionary) { }
    51     [StorableConstructor]
    52     protected ReadOnlyItemDictionary(bool deserializing) : base(deserializing) { }
    5358
    5459    public object Clone() {
     
    5661    }
    5762    public virtual IDeepCloneable Clone(Cloner cloner) {
    58       ReadOnlyItemDictionary<TKey, TValue> clone = (ReadOnlyItemDictionary<TKey, TValue>)Activator.CreateInstance(this.GetType());
    59       cloner.RegisterClonedObject(this, clone);
    60       clone.dict = (IItemDictionary<TKey, TValue>)((IItemDictionary<TKey, TValue>)dict).Clone(cloner);
    61       clone.RegisterEvents();
    62       return clone;
     63      return new ReadOnlyItemDictionary<TKey, TValue>(this, cloner);
    6364    }
    6465
Note: See TracChangeset for help on using the changeset viewer.