public static List<EditorObject> Clone(IDeepClone source, EditorScene destination) { Debug.Assert(source != null); List<IDeepClone> sourceList = new List<IDeepClone>(); sourceList.Add(source); return Clone(sourceList, destination); }
private static void GetReferences(IDeepClone entity, HashSet<IDeepClone> cloneList) { cloneList.Add(entity); foreach (IDeepClone cloneable in entity.GetCloneableRefs()) { GetReferences(cloneable, cloneList); } }
/// <summary> /// 获取当前类型的深度副本,尝试副本为新内存区域 /// </summary> /// <param name="value"></param> /// <returns></returns> public static T DeepClone <T>(IDeepClone <T> value) { try { return((T)All.Class.SingleFileSave.SSFile.Byte2Object(All.Class.SingleFileSave.SSFile.Object2Byte(value))); } catch { throw new Exception("请将要克隆的类标记为[Serializable]"); } }
/// <param name="cloneOnlyCtor"></param> protected Hashtable4(IDeepClone cloneOnlyCtor) : base(cloneOnlyCtor) { }
/// <param name="cloneOnlyCtor"></param> protected HashtableBase(IDeepClone cloneOnlyCtor) { }
/// <param name="cloneOnlyCtor"></param> protected HashtableBase(IDeepClone cloneOnlyCtor) { }
/// <param name="cloneOnlyCtor"></param> protected Hashtable4(IDeepClone cloneOnlyCtor) : base(cloneOnlyCtor) { }
/// <summary>Deep clone instance.</summary> /// <returns>Set of shallow cloned instances.</returns> public static Dictionary<IDeepClone, IDeepClone> Clone(IDeepClone toClone) { List<IDeepClone> list = new List<IDeepClone>(); list.Add(toClone); return Clone(list); }