public override DataElement Clone() { if (cracking) { return(new CloneCache(this, this.name).Get()); } if (cache == null) { cache = new CloneCache(this, this.name); } var ret = cache.Get() as DataModel; ret.cache = this.cache; return(ret); }
/// <summary> /// Creates a deep copy of the DataElement, and updates the appropriate Relations. /// </summary> /// <param name="newName">What name to set on the cloned DataElement</param> /// <param name="size">The size in bytes used when performing the copy. Useful for debugging statistics.</param> /// <returns>Returns a copy of the DataElement.</returns> public virtual DataElement Clone(string newName, ref long size) { if (DataElement.DebugClone) { logger.Debug("Clone {0} as {1}", fullName, newName); } var cache = new CloneCache(this, newName); var copy = cache.Get(); size = cache.Size; if (DataElement.DebugClone) { logger.Debug("Clone {0} took {1} bytes", copy.fullName, size); } return(copy); }