Northwoods.Go Assembly > Northwoods.Go Namespace > GoObject Class : CopyObject Method |
'Declaration Public Overridable Function CopyObject( _ ByVal env As GoCopyDictionary _ ) As GoObject
public virtual GoObject CopyObject( GoCopyDictionary env )
If you just need to make a copy of a GoObject, call GoObject.Copy, or GoDocument.GoDocument.AddCopy, or CopyFromCollection(IGoCollection) if you have more than one object to copy.
You should override this method in your derived classes when it has some fields that have reference objects that need to be copied. Your override method should first call base.CopyObject(env)
to get the newly copied object. The standard implementation of this method for GoObject is to do a shallow copy, by Object.MemberwiseClone()
. The result should be the object you return, after performing any other deeper copying of referenced objects that you deem necessary, and after removing references that should not be shared (such as to cached data structures). If base.CopyObject(env)
returns null, it's either already copied, or mapped to an existing object in this document, or shouldn't be copied at all.
The copied object does not belong to any layer or any group, nor does it have any observers; the ultimate caller (i.e. GoDocument.CopyFromCollection(IGoCollection)) is responsible for adding it to the appropriate collection and CopyObjectDelayed is responsible for adding the appropriate observers.
You probably should not be calling this method for any reason but the initial base.CopyObject(env)
call in an override of this method; normally only GoCopyDictionary.Copy is the caller. Within an override of this method, if you need to make a copy of another object, call GoCopyDictionary.Copy instead.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2