using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SCJMapper_V2 { //[Serializable] public class CloneableDictionary : Dictionary where TValue : ICloneable { public virtual object Clone( ) { CloneableDictionary clone = new CloneableDictionary(); foreach ( KeyValuePair kvp in this ) { clone.Add( kvp.Key, ( TValue )kvp.Value.Clone( ) ); } return clone; } } public class CloneableList : List where TValue : ICloneable { public virtual CloneableList Clone( ) { CloneableList clone = new CloneableList(); foreach ( TValue kvp in this ) { clone.Add( ( TValue )kvp.Clone( ) ); } return clone; } } }