PostSharp5.0/API Reference/Post­Sharp.​Aspects Namespace/Aspect­Utilities Class/Aspect­Utilities Methods/Aspect­Utilities.​Initialize­Current­Aspects Method

AspectUtilities.InitializeCurrentAspects Method

Initializes the all the aspects of the calling instance. This method must be invoked from an instance method (not a static method) of a type that has been enhanced by an aspect.

Namespace:  PostSharp.Aspects
Assembly:  PostSharp (in PostSharp.dll) Version: 5.0.55.0 (5.0.55.0)
Syntax
C#
public static void InitializeCurrentAspects()
Remarks

Calls to this method are transformed, at build time, to calls to this.InitializeAspects, a method that is typically generated by PostSharp. This is why the current method has actually no implementation.

The constructors of enhanced classes always initialize aspects. The only scenario where this method needs to be invoked manually is when instances are not built using the constructor, but for instance with the method GetUninitializedObject(Type).

See Also