Open sandboxFocus

Method AttachChild

AttachChild(object, object, ChildInfo)

Attach an object as a child of the current node.

Declaration
object AttachChild(object state, object child, ChildInfo childInfo)
Parameters
Type Name Description
object state

The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, object).

object child

The object that must be attached as a child to the current node.

ChildInfo childInfo

Information about the location (field or collection item, typically) to which the child is assigned and about the relationship of the current node relatively to the parent node. The Relationship property must be set to Child or ParentSurrogate

Returns
Type Description
object

The new parent of child, or null if child was already attached to the same parent node through another relationship. If the current node is a parent surrogate, the method returns the parent of the current node.

Remarks

The new parent of child will be the current node (the value returned by GetNode(object)); or the parent of the current node, if the current node is a parent surrogate.