AssemblyFlagsAttribute AssemblyFlagsAttribute AssemblyFlagsAttribute AssemblyFlagsAttribute Class

정의

어셈블리에 대해 JIT(Just-In-Time) 컴파일러 옵션, 어셈블리 대상 변경 가능 여부 그리고 어셈블리에 전체 공개 키 또는 토큰화된 공개 키가 있는지 여부를 설명하는 AssemblyNameFlags 플래그의 비트 조합을 지정합니다.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.

public ref class AssemblyFlagsAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed class AssemblyFlagsAttribute : Attribute
type AssemblyFlagsAttribute = class
    inherit Attribute
Public NotInheritable Class AssemblyFlagsAttribute
Inherits Attribute
상속
AssemblyFlagsAttributeAssemblyFlagsAttributeAssemblyFlagsAttributeAssemblyFlagsAttribute
특성

예제

다음 코드 예제에 적용 하는 방법을 보여 줍니다는 AssemblyFlagsAttribute 어셈블리를 런타임에 플래그를 읽는 방법.The following code example shows how to apply the AssemblyFlagsAttribute to an assembly, and how to read the flags at run time. 예제도 특성의 인스턴스를 사용 하 여 AssemblyFlags 플래그를 표시 하려면 속성입니다.The example also creates an instance of the attribute, and uses the AssemblyFlags property to display the flags. 적용 하는 방법의 예는 AssemblyFlagsAttribute 동적 어셈블리를 참조 합니다 AssemblyName.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 this assembly.
      Assembly^ thisAsm = Example::typeid->Assembly;
      
      // Get the AssemblyName for this 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
*/
using System;
using System.Reflection;

// Specify a combination of AssemblyNameFlags for this 
// assembly.
[assembly:AssemblyFlagsAttribute(
    AssemblyNameFlags.EnableJITcompileOptimizer |
    AssemblyNameFlags.Retargetable)]

public class Example
{
    public static void Main()
    {
        // Get this assembly.
        Assembly thisAsm = typeof(Example).Assembly;

        // Get the AssemblyName for this 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 = new AssemblyFlagsAttribute(
            AssemblyNameFlags.EnableJITcompileOptimizer |
            AssemblyNameFlags.Retargetable);

        // Get the flags. The property returns an integer, so
        // the return value must be cast to AssemblyNameFlags.
        AssemblyNameFlags anf = (AssemblyNameFlags) afa.AssemblyFlags;

        // Display the flags.
        Console.WriteLine();
        ListFlags(anf);
    }

    private static void ListFlags(AssemblyNameFlags anf)
    {
        if (anf == AssemblyNameFlags.None)
        {
            Console.WriteLine("AssemblyNameFlags.None");
        }
        else
        {
            if (0!=(anf & AssemblyNameFlags.Retargetable)) 
                Console.WriteLine("AssemblyNameFlags.Retargetable");
            if (0!=(anf & AssemblyNameFlags.PublicKey)) 
                Console.WriteLine("AssemblyNameFlags.PublicKey");
            if (0!=(anf & AssemblyNameFlags.EnableJITcompileOptimizer)) 
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileOptimizer");
            if (0!=(anf & AssemblyNameFlags.EnableJITcompileTracking)) 
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileTracking");
        }
    }
}

/* This code example produces the following output:

AssemblyNameFlags.Retargetable
AssemblyNameFlags.PublicKey
AssemblyNameFlags.EnableJITcompileOptimizer

AssemblyNameFlags.Retargetable
AssemblyNameFlags.EnableJITcompileOptimizer
*/
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 this assembly.
        Dim thisAsm As Assembly = GetType(Example).Assembly

        ' Get the AssemblyName for this 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

설명

AssemblyNameFlags 열거형이이 특성을 사용 하 여 설정할 수 있는 어셈블리 특성을 설명 합니다.The AssemblyNameFlags enumeration describes the assembly characteristics that can be set using this attribute.

어셈블리에 대 한 지정 된 플래그에 액세스 하려면 사용 합니다 Assembly.GetName 속성을는 AssemblyName 개체를 만든 다음 사용 하 여는 AssemblyName.Flags 속성을는 AssemblyNameFlags 값.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.

지정 하려면 AssemblyNameFlags 동적 어셈블리에 대 한 플래그를 설정할를 AssemblyName.Flags 의 속성을 AssemblyName 에 전달 하는 개체는 AppDomain.DefineDynamicAssembly 메서드.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.

생성자

AssemblyFlagsAttribute(AssemblyNameFlags) AssemblyFlagsAttribute(AssemblyNameFlags) AssemblyFlagsAttribute(AssemblyNameFlags) AssemblyFlagsAttribute(AssemblyNameFlags)

지정된 AssemblyFlagsAttribute 플래그 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags.

AssemblyFlagsAttribute(Int32) AssemblyFlagsAttribute(Int32) AssemblyFlagsAttribute(Int32) AssemblyFlagsAttribute(Int32)

정수 값으로 캐스팅된 AssemblyFlagsAttribute 플래그의 지정된 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags, cast as an integer value.

AssemblyFlagsAttribute(UInt32) AssemblyFlagsAttribute(UInt32) AssemblyFlagsAttribute(UInt32) AssemblyFlagsAttribute(UInt32)

부호 없는 정수 값으로 캐스팅된 AssemblyFlagsAttribute 플래그의 지정된 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the AssemblyFlagsAttribute class with the specified combination of AssemblyNameFlags flags, cast as an unsigned integer value.

속성

AssemblyFlags AssemblyFlags AssemblyFlags AssemblyFlags

이 특성 인스턴스가 만들어졌을 때 지정된 AssemblyNameFlags 플래그의 조합을 나타내는 정수 값을 가져옵니다.Gets an integer value representing the combination of AssemblyNameFlags flags specified when this attribute instance was created.

Flags Flags Flags Flags

이 특성 인스턴스가 만들어졌을 때 지정된 AssemblyNameFlags 플래그의 조합을 나타내는 부호 없는 정수 값을 가져옵니다.Gets an unsigned integer value representing the combination of AssemblyNameFlags flags specified when this attribute instance was created.

TypeId TypeId TypeId TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

@FSHO2@이 인스턴스가 지정한 개체와 같은지를 나타내는 값을 반환합니다.Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.Returns the hash code for this instance.

(Inherited from Attribute)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() 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(Object) Match(Object) Match(Object) Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

명시적 인터페이스 구현

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

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

적용 대상

추가 정보