AssemblyFlagsAttribute 클래스

정의

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

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

예제

다음 코드 예제에서는 어셈블리에 를 적용 AssemblyFlagsAttribute 하는 방법 및 런타임에 플래그를 읽는 방법을 보여 주세요. 또한 이 예제에서는 특성의 인스턴스를 만들고 속성을 사용하여 AssemblyFlags 플래그를 표시합니다. 동적 어셈블리에 를 적용 AssemblyFlagsAttribute 하는 방법에 대한 예제는 속성을 참조 AssemblyName.Flags 하세요.

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.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 이 특성을 사용하여 설정할 수 있는 어셈블리 특성을 설명합니다.

어셈블리에 대해 지정된 플래그에 액세스하려면 속성을 사용하여 Assembly.GetName 개체를 AssemblyName 가져온 다음 속성을 사용하여 AssemblyName.Flags 값을 가져옵니다 AssemblyNameFlags .

동적 어셈블리에 대한 플래그를 지정 AssemblyNameFlags 하려면 메서드에 AssemblyName.FlagsAssemblyName 전달하는 AppDomain.DefineDynamicAssembly 개체의 속성을 설정합니다.

생성자

AssemblyFlagsAttribute(AssemblyNameFlags)

지정된 AssemblyFlagsAttribute 플래그 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.

AssemblyFlagsAttribute(Int32)
사용되지 않음.
사용되지 않음.
사용되지 않음.

정수 값으로 캐스팅된 AssemblyFlagsAttribute 플래그의 지정된 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.

AssemblyFlagsAttribute(UInt32)
사용되지 않음.
사용되지 않음.
사용되지 않음.

부호 없는 정수 값으로 캐스팅된 AssemblyFlagsAttribute 플래그의 지정된 조합을 사용하여 AssemblyNameFlags 클래스의 새 인스턴스를 초기화합니다.

속성

AssemblyFlags

이 특성 인스턴스가 만들어졌을 때 지정된 AssemblyNameFlags 플래그의 조합을 나타내는 정수 값을 가져옵니다.

Flags
사용되지 않음.
사용되지 않음.
사용되지 않음.

이 특성 인스턴스가 만들어졌을 때 지정된 AssemblyNameFlags 플래그의 조합을 나타내는 부호 없는 정수 값을 가져옵니다.

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

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

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보