Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Model Namespace / Parent­Attribute Class

ParentAttribute Class

Custom attribute that, when applied to a field or automatic property, specifies that this field or property should be automatically set to the parent of the instance of the declaring type, whenever this instance is attached as a child to another object.
Inheritance Hierarchy
System.Object
  System.Attribute
    PostSharp.Patterns.Model.MemberRelationshipAttribute
      PostSharp.Patterns.Model.ParentAttribute

Namespace:  PostSharp.Patterns.Model
Assembly:  PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 5.0.38.0 (5.0.38.0)
Syntax
C#
public sealed class ParentAttribute : MemberRelationshipAttribute

The ParentAttribute type exposes the following members.

Constructors
  NameDescription
Public methodParentAttribute
Initializes a new instance of the ParentAttribute class
Methods
  NameDescription
Public methodCompileTimeValidate
Method invoked at build time to ensure that the aspect has been applied to the right target.
(Inherited from MemberRelationshipAttribute.)
Extension Methods
  NameDescription
Public Extension MethodQueryInterface<T>
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.)
Remarks

It is recommended to add this custom attribute only to private fields or automatic properties with a private setter.

See Also