GoDiagram Web Reference
CopyObject Method (GoObject)

The GoCopyDictionary provides the context to be used for performing the copy.
Called during the first phase of the copy process to produce a copy of this object within the given copy dictionary.
Syntax
'Declaration
 
Public Overridable Function CopyObject( _
   ByVal env As GoCopyDictionary _
) As GoObject
public virtual GoObject CopyObject( 
   GoCopyDictionary env
)

Parameters

env
The GoCopyDictionary provides the context to be used for performing the copy.

Return Value

A newly allocated copy of this object, or null.
Remarks

If you just need to make a copy of a GoObject, call GoObject.Copy, or 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.GoCopyDictionary.Copy is the caller. Within an override of this method, if you need to make a copy of another object, call GoCopyDictionary.GoCopyDictionary.Copy instead.

Requirements

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

See Also

Reference

GoObject Class
GoObject Members

 

 


© 2013. Northwoods Software Corporation. All Rights Reserved.

Send Feedback