- Timestamp:
- 10/29/10 17:38:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemArray.cs
r4419 r4668 46 46 } 47 47 48 [StorableConstructor] 49 protected ItemArray(bool deserializing) : base(deserializing) { } 50 protected ItemArray(ItemArray<T> original, Cloner cloner) { 51 cloner.RegisterClonedObject(original, this); 52 array = original.Select(x => cloner.Clone<T>(x)).ToArray(); 53 } 48 54 public ItemArray() : base() { } 49 55 public ItemArray(int length) : base(length) { } 50 56 public ItemArray(T[] array) : base(array) { } 51 57 public ItemArray(IEnumerable<T> collection) : base(collection) { } 52 [StorableConstructor]53 protected ItemArray(bool deserializing) : base(deserializing) { }54 58 55 59 public object Clone() { … … 57 61 } 58 62 public virtual IDeepCloneable Clone(Cloner cloner) { 59 ItemArray<T> clone = (ItemArray<T>)Activator.CreateInstance(this.GetType()); 60 cloner.RegisterClonedObject(this, clone); 61 clone.array = this.Select(x => (T)cloner.Clone(x)).ToArray(); 62 return clone; 63 return new ItemArray<T>(this, cloner); 63 64 } 64 65
Note: See TracChangeset
for help on using the changeset viewer.