PostSharp 2023.0 / / 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: 2023.0.3.0 (2023.0.3.0)
Object AttachChild(
	Object state,
	Object child,
	ChildInfo childInfo


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