PostSharpAPI ReferencePost­Sharp.​Patterns.​Model.​Type­AdaptersType­AdapterAttach­To­Parent
Open sandboxFocus

TypeAdapter.AttachToParent Method

AttachToParent(Object, RelationshipInfo, IAttacher, Object)

Attaches an object to a parent object.

public virtual bool AttachToParent(object obj, RelationshipInfo relationshipInfo, IAttacher attacher, object attacherState)
Type Name Description
Object obj

An instance of the adapted type.

RelationshipInfo relationshipInfo

Information about the relationship of the parent node relatively to the current node. The Relationship property must be set to Child or ParentSurrogate.

IAttacher attacher

A service that allows the current node to attach itself to the parent.

Object attacherState

An opaque state object to be passed as the first argument to all methods of the IAttacher interface.

Type Description

true if the current object was not previously attached to any parent, false if it was already attached to the same parent.


This method is equivalent to AttachToParent(RelationshipInfo, IAttacher, Object).

Implementations of this method can use the AttachChild(Object, RelationshipInfo, IAttacher, Object) method to attach items to the parent.