AssemblyFlagsAttribute Class
Assembly: mscorlib (in mscorlib.dll)
'Declaration <ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Assembly, Inherited:=False)> _ Public NotInheritable Class AssemblyFlagsAttribute Inherits Attribute 'Usage Dim instance As AssemblyFlagsAttribute
/** @attribute ComVisibleAttribute(true) */ /** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, Inherited=false) */ public final class AssemblyFlagsAttribute extends Attribute
ComVisibleAttribute(true) AttributeUsageAttribute(AttributeTargets.Assembly, Inherited=false) public final class AssemblyFlagsAttribute extends Attribute
Not applicable.
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 System.Reflection.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 System.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.
Imports System Imports System.Reflection ' Specify a combination of AssemblyNameFlags for this ' assembly. <Assembly:AssemblyFlagsAttribute( _ AssemblyNameFlags.EnableJITcompileOptimizer _ Or AssemblyNameFlags.Retargetable)> Public Class Example Public Shared Sub Main() ' Get the currently executing assembly, which is this ' assembly. Dim thisAsm As Assembly = _ Assembly.GetExecutingAssembly() ' Get the AssemblyName for the currently executing ' assembly. Dim thisAsmName As AssemblyName = 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. Dim afa As New AssemblyFlagsAttribute( _ AssemblyNameFlags.EnableJITcompileOptimizer _ Or AssemblyNameFlags.Retargetable) ' Get the flags. The property returns an integer, so ' the return value must be cast to AssemblyNameFlags. Dim anf As AssemblyNameFlags = _ CType(afa.AssemblyFlags, AssemblyNameFlags) ' Display the flags. Console.WriteLine() ListFlags(anf) End Sub Private Shared Sub ListFlags(ByVal anf As AssemblyNameFlags) If anf = AssemblyNameFlags.None Then Console.WriteLine("AssemblyNameFlags.None") Else If 0 <> (anf And AssemblyNameFlags.Retargetable) Then _ Console.WriteLine("AssemblyNameFlags.Retargetable") If 0 <> (anf And AssemblyNameFlags.PublicKey) Then _ Console.WriteLine("AssemblyNameFlags.PublicKey") If 0 <> (anf And AssemblyNameFlags.EnableJITcompileOptimizer) Then _ Console.WriteLine("AssemblyNameFlags.EnableJITcompileOptimizer") If 0 <> (anf And AssemblyNameFlags.EnableJITcompileTracking) Then _ Console.WriteLine("AssemblyNameFlags.EnableJITcompileTracking") End If End SUb End Class ' This code example produces the following output: ' 'AssemblyNameFlags.Retargetable 'AssemblyNameFlags.PublicKey 'AssemblyNameFlags.EnableJITcompileOptimizer ' 'AssemblyNameFlags.Retargetable 'AssemblyNameFlags.EnableJITcompileOptimizer
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.