AssemblyFlagsAttribute Class
Specifies a bitwise combination of AssemblyNameFlags flags for an assembly, describing just-in-time (JIT) compiler options, whether the assembly is retargetable, and whether it has a full or tokenized public key. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
The AssemblyFlagsAttribute type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | AssemblyFlagsAttribute(AssemblyNameFlags) | Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags. |
![]() ![]() | AssemblyFlagsAttribute(Int32) | Obsolete. Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags, cast as an integer value. |
![]() ![]() | AssemblyFlagsAttribute(UInt32) | Obsolete. Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags, cast as an unsigned integer value. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | AssemblyFlags | Gets an integer value representing the combination of AssemblyNameFlags flags specified when this attribute instance was created. |
![]() ![]() | Flags | Obsolete. Gets an unsigned integer value representing the combination of AssemblyNameFlags flags specified when this attribute instance was created. |
![]() | TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.) |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) |
![]() ![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() ![]() | GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) |
![]() ![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.) |
![]() ![]() | Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) |
![]() ![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | _Attribute::GetIDsOfNames | Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.) |
![]() ![]() | _Attribute::GetTypeInfo | Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.) |
![]() ![]() | _Attribute::GetTypeInfoCount | Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.) |
![]() ![]() | _Attribute::Invoke | Provides access to properties and methods exposed by an object. (Inherited from Attribute.) |
The AssemblyNameFlags enumeration describes the assembly characteristics that can be set using this attribute.
To access the flags that have been specified for an assembly, use the Assembly::GetName property to obtain an AssemblyName object, then use the AssemblyName::Flags property to obtain an AssemblyNameFlags value.
To specify AssemblyNameFlags flags for a dynamic assembly, set the AssemblyName::Flags property of the AssemblyName object that you pass to the AppDomain::DefineDynamicAssembly method.
The following code example shows how to apply the AssemblyFlagsAttribute to an assembly, and how to read the flags at run time. The example also creates an instance of the attribute, and uses the AssemblyFlags property to display the flags. For an example of how to apply the AssemblyFlagsAttribute to a dynamic assembly, see the AssemblyName::Flags property.
using namespace System; using namespace System::Reflection; // Specify a combination of AssemblyNameFlags for this // assembly. [assembly:AssemblyFlagsAttribute( AssemblyNameFlags::EnableJITcompileOptimizer | AssemblyNameFlags::Retargetable)]; public ref class Example { public: static void Main() { // Get the currently executing assembly, which is this // assembly. Assembly^ thisAsm = Assembly::GetExecutingAssembly(); // Get the AssemblyName for the currently executing // assembly. AssemblyName^ thisAsmName = thisAsm->GetName( false ); // Display the flags that were set for this assembly. ListFlags( thisAsmName->Flags ); // Create an instance of AssemblyFlagsAttribute with the // same combination of flags that was specified for this // assembly. Note that PublicKey is included automatically // for the assembly, but not for this instance of // AssemblyFlagsAttribute. AssemblyFlagsAttribute^ afa = gcnew AssemblyFlagsAttribute( static_cast<AssemblyNameFlags> (AssemblyNameFlags::EnableJITcompileOptimizer | AssemblyNameFlags::Retargetable) ); // Get the flags. The property returns an integer, so // the return value must be cast to AssemblyNameFlags. AssemblyNameFlags anf = static_cast<AssemblyNameFlags>(afa->AssemblyFlags); // Display the flags. Console::WriteLine(); ListFlags( anf ); } private: static void ListFlags( AssemblyNameFlags anf ) { if ( anf == AssemblyNameFlags::None ) { Console::WriteLine( L"AssemblyNameFlags.None" ); } else { if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::Retargetable) ) Console::WriteLine( L"AssemblyNameFlags.Retargetable" ); if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::PublicKey) ) Console::WriteLine( L"AssemblyNameFlags.PublicKey" ); if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::EnableJITcompileOptimizer) ) Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileOptimizer" ); if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::EnableJITcompileTracking) ) Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileTracking" ); } } }; int main() { Example::Main(); } /* This code example produces the following output: AssemblyNameFlags.Retargetable AssemblyNameFlags.PublicKey AssemblyNameFlags.EnableJITcompileOptimizer AssemblyNameFlags.Retargetable AssemblyNameFlags.EnableJITcompileOptimizer */
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

