- 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/ItemCollection.cs
r4419 r4722 46 46 } 47 47 48 [StorableConstructor] 49 protected ItemCollection(bool deserializing) : base(deserializing) { } 50 protected ItemCollection(ItemCollection<T> original, Cloner cloner) { 51 cloner.RegisterClonedObject(original, this); 52 list = new List<T>(original.Select(x => cloner.Clone(x))); 53 } 48 54 public ItemCollection() : base() { } 49 55 public ItemCollection(int capacity) : base(capacity) { } 50 56 public ItemCollection(IEnumerable<T> collection) : base(collection) { } 51 [StorableConstructor]52 protected ItemCollection(bool deserializing) : base(deserializing) { }53 57 54 58 public object Clone() { … … 56 60 } 57 61 public virtual IDeepCloneable Clone(Cloner cloner) { 58 ItemCollection<T> clone = (ItemCollection<T>)Activator.CreateInstance(this.GetType()); 59 cloner.RegisterClonedObject(this, clone); 60 clone.list = new List<T>(this.Select(x => (T)cloner.Clone(x))); 61 return clone; 62 return new ItemCollection<T>(this, cloner); 62 63 } 63 64
Note: See TracChangeset
for help on using the changeset viewer.