GoDiagram Web Reference
Copy Method (GoObject)

This convenience method just makes a copy of the object itself, using a generic GoCopyDictionary.
Syntax
'Declaration
 
Public Function Copy() As GoObject
public GoObject Copy()
Remarks

The easiest way to add a copy of an object to a document is to call GoDocument.AddCopy.

This method is implemented as:

              GoDocument doc = this.Document;
              GoCopyDictionary env;
              if (doc != null)
                env = doc.CreateCopyDictionary();
              else
                env = new GoCopyDictionary();
              return env.CopyComplete(this);
            
GoCopyDictionary.GoCopyDictionary.Copy calls CopyObject to allow the object to decide how to copy itself. Although the use of a copy dictionary isn't really needed for the simplest objects, more complex objects (such as GoGroups) may contain references that need to be resolved with a second pass.

If you want to copy many objects, it will be more efficient to allocate your own GoCopyDictionary, call GoCopyDictionary.GoCopyDictionary.Copy on each object, and then finally call GoCopyDictionary.FinishDelayedCopies. But if you are just going to be adding those copied objects into a GoDocument, just call CopyFromCollection(IGoCollection) or the more general override of that method.

If you want to make many copies of one object, it will be more efficient to allocate your own GoCopyDictionary, and then for each copy you want to make, call GoCopyDictionary.CopyComplete on the object followed by a call to Clear() the dictionary. Clearing the copy dictionary will make sure each CopyComplete call does not share any references with any other copy.

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