PostSharp 6.10 / / Post­Sharp Documentation / 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: (
public static void InitializeCurrentAspects()

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