- Timestamp:
- 10/29/10 17:38:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs
r4419 r4668 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<TKey>(key), cloner.Clone<TValue>(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.