GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoGroup Class / CopyChildren Method
In This Topic
    CopyChildren Method (GoGroup)
    In This Topic
    Copy this group's children.
    Syntax
    protected virtual void CopyChildren( 
       GoGroup newgroup,
       GoCopyDictionary env
    )

    Parameters

    newgroup
    env
    Remarks
    This method is responsible for copying and adding this group's child objects to the newgroup. By default, this simply calls newgroup.Add(env.Copy(obj)) for each child obj. However, your group subclass may want to keep track of some or all of the children for its own purposes. To that end you can override this method to do the copying manually, thereby correctly maintaining your subclass's internal pointers to children. You probably should not be calling GoObject's GoObject.CopyObject, but GoCopyDictionary's Copy or indexed lookup instead.
    Example
    For example, a group holding an Icon, a Label, an InPort, and an OutPort might implement this method as follows:
    
                base.CopyChildren(newgroup, env);
                MyNode newnode = (MyNode)newgroup;
                newnode.myIcon = (GoObject)env[myIcon];
                newnode.myLabel = (GoText)env[myLabel];
                newnode.myInPort = (GoPort)env[myInPort];
                newnode.myOutPort = (GoPort)env[myOutPort];
                
    Note that this indexing use of GoCopyDictionary can handle null references--it returns null.
    See Also