ModuleInitializerAttribute Clase

Definición

Se usa para indicar al compilador que se debe llamar a un método en el inicializador del módulo contenedor.Used to indicate to the compiler that a method should be called in its containing module's initializer.

public ref class ModuleInitializerAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class ModuleInitializerAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
type ModuleInitializerAttribute = class
    inherit Attribute
Public NotInheritable Class ModuleInitializerAttribute
Inherits Attribute
Herencia
ModuleInitializerAttribute
Atributos

Comentarios

Cuando se encuentran uno o más métodos válidos con este atributo en una compilación, el compilador emitirá un inicializador de módulo que llame a cada uno de los métodos con atributos.When one or more valid methods with this attribute are found in a compilation, the compiler will emit a module initializer that calls each of the attributed methods.

Ciertos requisitos se imponen en cualquier método destinado a este atributo:Certain requirements are imposed on any method targeted with this attribute:

  • El método debe ser static .The method must be static.
  • El método debe ser un método de miembro ordinario, en lugar de un descriptor de acceso de propiedad, un constructor, una función local, etc.The method must be an ordinary member method, as opposed to a property accessor, constructor, local function, and so on.
  • El método no debe tener parámetros.The method must be parameterless.
  • El método debe devolver void.The method must return void.
  • El método no debe ser genérico ni estar incluido en un tipo genérico.The method must not be generic or be contained in a generic type.
  • La accesibilidad efectiva del método debe ser internal o public .The method's effective accessibility must be internal or public.

Para obtener más información, vea la especificación de los inicializadores de módulos.For more information, see the specification for module initializers.

Constructores

ModuleInitializerAttribute()

Inicializa una nueva instancia de la clase ModuleInitializerAttribute.Initializes a new instance of the ModuleInitializerAttribute class.

Propiedades

TypeId

Cuando se implementa en una clase derivada, obtiene un identificador único para este Attribute.When implemented in a derived class, gets a unique identifier for this Attribute.

(Heredado de Attribute)

Métodos

Equals(Object)

Devuelve un valor que indica si esta instancia es igual que un objeto especificado.Returns a value that indicates whether this instance is equal to a specified object.

(Heredado de Attribute)
GetHashCode()

Devuelve el código hash de esta instancia.Returns the hash code for this instance.

(Heredado de Attribute)
GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Heredado de Object)
IsDefaultAttribute()

Si se reemplaza en una clase derivada, indica si el valor de esta instancia es el valor predeterminado de la clase derivada.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Heredado de Attribute)
Match(Object)

Cuando se invalida en una clase derivada, devuelve un valor que indica si esta instancia es igual a un objeto especificado.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Heredado de Attribute)
MemberwiseClone()

Crea una copia superficial del Object actual.Creates a shallow copy of the current Object.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Heredado de Object)

Implementaciones de interfaz explícitas

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Asigna un conjunto de nombres a un conjunto correspondiente de identificadores de envío.Maps a set of names to a corresponding set of dispatch identifiers.

(Heredado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Obtiene la información de tipos de un objeto, que puede utilizarse para obtener la información de tipos de una interfaz.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Heredado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Recupera el número de interfaces de información de tipo que proporciona un objeto (0 ó 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Heredado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Proporciona acceso a las propiedades y los métodos expuestos por un objeto.Provides access to properties and methods exposed by an object.

(Heredado de Attribute)

Se aplica a