ModuleInitializerAttribute Třída

Definice

Slouží k označení kompilátoru, že by měla být metoda volána v rámci jejího obsahujícího inicializátoru modulu.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
Dědičnost
ModuleInitializerAttribute
Atributy

Poznámky

Pokud je v kompilaci zjištěna jedna nebo více platných metod s tímto atributem, kompilátor vygeneruje inicializátor modulu, který bude volat všechny metody v atributu.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.

Některé požadavky jsou zavedeny na jakékoli metodě, která je cílem tohoto atributu:Certain requirements are imposed on any method targeted with this attribute:

  • Metoda musí být static .The method must be static.
  • Metoda musí být běžnou členskou metodou, a to na rozdíl od přístupového objektu vlastnosti, konstruktoru, místní funkce a tak dále.The method must be an ordinary member method, as opposed to a property accessor, constructor, local function, and so on.
  • Metoda musí být bez parametrů.The method must be parameterless.
  • Metoda musí vracet void .The method must return void.
  • Metoda nesmí být obecná nebo musí být obsažena v obecném typu.The method must not be generic or be contained in a generic type.
  • Efektivní přístupnost metody musí být internal nebo public .The method's effective accessibility must be internal or public.

Další informace naleznete v tématu specifikace pro Inicializátory modulu.For more information, see the specification for module initializers.

Konstruktory

ModuleInitializerAttribute()

Inicializuje novou instanci ModuleInitializerAttribute třídy.Initializes a new instance of the ModuleInitializerAttribute class.

Vlastnosti

TypeId

Při implementaci v odvozené třídě získá jedinečný identifikátor Attribute .When implemented in a derived class, gets a unique identifier for this Attribute.

(Zděděno od Attribute)

Metody

Equals(Object)

Vrací hodnotu, která určuje, zda je tato instance rovna zadanému objektu.Returns a value that indicates whether this instance is equal to a specified object.

(Zděděno od Attribute)
GetHashCode()

Vrátí hodnotu hash pro tuto instanci.Returns the hash code for this instance.

(Zděděno od Attribute)
GetType()

Získá Type aktuální instanci.Gets the Type of the current instance.

(Zděděno od Object)
IsDefaultAttribute()

Při přepsání v odvozené třídě označuje, zda je hodnota této instance výchozí hodnotou pro odvozenou třídu.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Zděděno od Attribute)
Match(Object)

Při přepsání v odvozené třídě vrátí hodnotu, která označuje, zda je tato instance rovna zadanému objektu.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Zděděno od Attribute)
MemberwiseClone()

Vytvoří kopii aktuálního seznamu Object .Creates a shallow copy of the current Object.

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.Returns a string that represents the current object.

(Zděděno od Object)

Explicitní implementace rozhraní

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

Mapuje sadu názvů na odpovídající sadu identifikátorů pro rozesílání.Maps a set of names to a corresponding set of dispatch identifiers.

(Zděděno od Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Načte informace o typu pro objekt, který lze použít k získání informací o typu pro rozhraní.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Zděděno od Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Získá počet rozhraní typu informací, které objekt poskytuje (0 nebo 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Zděděno od Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Poskytuje přístup k vlastnostem a metodám vystaveným objektem.Provides access to properties and methods exposed by an object.

(Zděděno od Attribute)

Platí pro