Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Enumerations, or enums, are defined in the scope of a dynamic module using the ModuleBuilder.DefineEnum method. DefineEnum returns an EnumBuilder.
An enumeration field is defined using the System.Reflection.Emit.EnumBuilder.DefineLiteral(System.String,System.Object) method, as demonstrated by the code example for that method.
Before the enumeration is used, the EnumBuilder.CreateType method must be called. CreateType completes the creation of the enumeration.
Note |
|---|
In the .NET Framework versions 1.0 and 1.1, it is necessary to define enumerations using TypeBuilder because EnumBuilder emits enumerations whose elements are of type Int32 instead of the enumeration type. In the .NET Framework version 2.0, EnumBuilder emits enumerations whose elements have the correct type. |
See Also
Reference
EnumBuilder
System.Reflection.Emit.EnumBuilder.DefineLiteral(System.String,System.Object)
Note