PostSharpAPI ReferencePost­Sharp.​AspectsAspect­UtilitiesInitialize­Current­Aspects
Open sandboxFocus

AspectUtilities.InitializeCurrentAspects Method

InitializeCurrentAspects()

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.

Declaration
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