Open sandboxFocus

Class ModuleInitializerAttribute

Custom attribute that, when added to a static method, causes the method to be executed immediately after the assembly is loaded by the CLR. The target method must be static, public or internal, parameterless, void, and non-generic.

Inheritance
ModuleInitializerAttribute
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Method)]
[RequirePostSharp(null, "ModuleInitializer")]
public sealed class ModuleInitializerAttribute : Attribute
Remarks

PostSharp emits an error at build time when the target method does not meet the requirements above. A project can contain several module initializers; they are executed in the order given by Order.

Constructors

Name Description
ModuleInitializerAttribute(int)

Initializes a new instance of the ModuleInitializerAttribute class.

Properties

Name Description
Order

Gets the order in which the ModuleInitializerAttribute will be executed if the current project contains several initializers. Initializers with smaller values of the Order property are invoked first.

See Also