PostSharp 6.9 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Aspects.​Advices Namespace / On­Instance­Constructed­Advice Class

OnInstanceConstructedAdvice Class

Custom attribute that, when applied to a method of an aspect, specifies that this method should be executed after the last instance constructor of the target class of the aspect has completed execution. That is, this method will be invoked when the target object will be fully constructed. This custom attribute can be applied only on methods that have return type void and no parameters.
Inheritance Hierarchy

Namespace:  PostSharp.Aspects.Advices
Assembly:  PostSharp (in PostSharp.dll) Version: (
public sealed class OnInstanceConstructedAdvice : Advice

The OnInstanceConstructedAdvice type exposes the following members.

Public methodOnInstanceConstructedAdvice
Initializes a new instance of the OnInstanceConstructedAdvice class
Public propertyDescription
A human-readable description of the current advice.
(Inherited from Advice.)
Public propertyLinesOfCodeAvoided
Reduction in the code lines count achieved by applying the advice instance to one code element.
(Inherited from Advice.)
The target object is fully constructed when all its constructors complete execution, including constructors of subclasses. For example, if you apply this advice to type A, and class B extends class A, then if you create a new instance of B, the method will be invoked only after B's constructor ends.
See Also