- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs
r4419 r4722 48 48 } 49 49 50 [StorableConstructor] 51 protected ItemDictionary(bool deserializing) : base(deserializing) { } 52 protected ItemDictionary(ItemDictionary<TKey, TValue> original, Cloner cloner) { 53 cloner.RegisterClonedObject(original, this); 54 foreach (TKey key in dict.Keys) 55 dict.Add(cloner.Clone(key), cloner.Clone(dict[key])); 56 } 50 57 public ItemDictionary() : base() { } 51 58 public ItemDictionary(int capacity) : base(capacity) { } 52 59 public ItemDictionary(IDictionary<TKey, TValue> dictionary) : base(dictionary) { } 53 [StorableConstructor]54 protected ItemDictionary(bool deserializing) : base(deserializing) { }55 60 56 61 public object Clone() { … … 58 63 } 59 64 public virtual IDeepCloneable Clone(Cloner cloner) { 60 ItemDictionary<TKey, TValue> clone = (ItemDictionary<TKey, TValue>)Activator.CreateInstance(this.GetType()); 61 cloner.RegisterClonedObject(this, clone); 62 foreach (TKey key in dict.Keys) 63 clone.dict.Add((TKey)cloner.Clone(key), (TValue)cloner.Clone(dict[key])); 64 return clone; 65 return new ItemDictionary<TKey, TValue>(this, cloner); 65 66 } 66 67
Note: See TracChangeset
for help on using the changeset viewer.