PostSharp 6.8 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Model Namespace / IAttacher Interface / IAttacher Methods / IAttacher.​Attach­Child Method

IAttacher.AttachChild Method

Attach an object as a child of the current node.

Namespace:  PostSharp.Patterns.Model
Assembly:  PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.8.6.0 (6.8.6.0)
Syntax
C#
Object AttachChild(
	Object state,
	Object child,
	ChildInfo childInfo
)

Parameters

state
Type: System.Object
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).
child
Type: System.Object
The object that must be attached as a child to the current node.
childInfo
Type: PostSharp.Patterns.Model.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

Return Value

Type: 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.
See Also