Changeset 2830 for trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs
- Timestamp:
- 02/19/10 02:15:10 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs
r2790 r2830 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Collections; 24 25 using System.Collections.Generic; … … 56 57 public ItemCollection() : base() { } 57 58 public ItemCollection(int capacity) : base(capacity) { } 58 public ItemCollection(IEnumerable<T> collection) : base(collection) { } 59 public ItemCollection(IEnumerable<T> collection) : base(collection) { 60 foreach (T item in this) 61 item.Changed += new ChangedEventHandler(Item_Changed); 62 } 59 63 60 64 public object Clone() { … … 62 66 } 63 67 64 public IDeepCloneable Clone(Cloner cloner) { 65 List<T> items = new List<T>(); 66 foreach (T item in this) 67 items.Add((T)cloner.Clone(item)); 68 ItemCollection<T> clone = (ItemCollection<T>)Activator.CreateInstance(this.GetType(), items); 68 public virtual IDeepCloneable Clone(Cloner cloner) { 69 ItemCollection<T> clone = (ItemCollection<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x))); 69 70 cloner.RegisterClonedObject(this, clone); 70 71 return clone;
Note: See TracChangeset
for help on using the changeset viewer.