Type.AssemblyQualifiedName 속성

정의

Type 개체가 로드된 어셈블리의 이름을 비롯하여 형식의 어셈블리 한정 이름을 가져옵니다.

public:
 abstract property System::String ^ AssemblyQualifiedName { System::String ^ get(); };
public abstract string AssemblyQualifiedName { get; }
public abstract string? AssemblyQualifiedName { get; }
member this.AssemblyQualifiedName : string
Public MustOverride ReadOnly Property AssemblyQualifiedName As String

속성 값

Type이 로드된 어셈블리의 이름을 비롯한 Type의 어셈블리 한정 이름입니다. 현재 인스턴스가 제네릭 형식 매개 변수를 나타낼 경우에는 null입니다.

구현

예제

다음 예제에서는 클래스와 연결된 어셈블리 이름과 형식의 정규화된 이름을 표시합니다.

using namespace System;
using namespace System::Reflection;
int main()
{
   Type^ objType = System::Array::typeid;
   
   // Print the full assembly name.
   Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName );
   
   // Print the qualified assembly name.
   Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName );
}
// The example displays the following output if run under the .NET Framework 4.5:
//    Full assembly name:
//       mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
//    Qualified assembly name:
//       System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
using System;

class MyAssemblyClass
{
    public static void Main()
    {
        Type objType = typeof(Array);

        // Print the assembly full name.
        Console.WriteLine($"Assembly full name:\n   {objType.Assembly.FullName}.");

        // Print the assembly qualified name.
        Console.WriteLine($"Assembly qualified name:\n   {objType.AssemblyQualifiedName}.");
    }
}
// The example displays the following output if run under the .NET Framework 4.5:
//    Assembly full name:
//       mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
//    Assembly qualified name:
//       System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
open System

let objType = typeof<Array>

// Print the assembly full name.
printfn $"Assembly full name:\n   {objType.Assembly.FullName}."

// Print the assembly qualified name.
printfn $"Assembly qualified name:\n   {objType.AssemblyQualifiedName}."
// The example displays the following output if run under the .NET Framework 4.5:
//    Assembly full name:
//       mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
//    Assembly qualified name:
//       System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
Class Example
    Public Shared Sub Main()
        Dim objType As Type = GetType(Array)

        ' Display the assembly full name.
        Console.WriteLine($"Assembly full name:{vbCrLf}   {objType.Assembly.FullName}.")

        ' Display the assembly qualified name.
        Console.WriteLine($"Assembly qualified name:{vbCrLf}   {objType.AssemblyQualifiedName}.")
    End Sub
End Class
' The example displays the following output if run under the .NET Framework 4.5:
'    Assembly full name:
'       mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
'    Assembly qualified name:
'       System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

다음 예제에서는 메서드에서 반환 ToString 된 문자열과 Name, FullNameAssemblyQualifiedName 속성을 비교합니다.

using System;
using System.Collections.Generic;
using System.Globalization;

public class Example
{
    public static void Main()
    {
        Type t = typeof(String);
        ShowTypeInfo(t);

        t = typeof(List<>);
        ShowTypeInfo(t);

        var list = new List<String>();
        t = list.GetType();
        ShowTypeInfo(t);

        Object v = 12;
        t = v.GetType();
        ShowTypeInfo(t);

        t = typeof(IFormatProvider);
        ShowTypeInfo(t);

        IFormatProvider ifmt = NumberFormatInfo.CurrentInfo;
        t = ifmt.GetType();
        ShowTypeInfo(t);
    }

    private static void ShowTypeInfo(Type t)
    {
        Console.WriteLine($"Name: {t.Name}");
        Console.WriteLine($"Full Name: {t.FullName}");
        Console.WriteLine($"ToString:  {t}");
        Console.WriteLine($"Assembly Qualified Name: {t.AssemblyQualifiedName}");
        Console.WriteLine();
    }
}
// The example displays output like the following:
//    Name: String
//    Full Name: System.String
//    ToString:  System.String
//    Assembly Qualified Name: System.String, mscorlib, Version=4.0.0.0, Culture=neutr
//    al, PublicKeyToken=b77a5c561934e089
//
//    Name: List`1
//    Full Name: System.Collections.Generic.List`1
//    ToString:  System.Collections.Generic.List`1[T]
//    Assembly Qualified Name: System.Collections.Generic.List`1, mscorlib, Version=4.
//    0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: List`1
//    Full Name: System.Collections.Generic.List`1[[System.String, mscorlib, Version=4
//    .0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
//    ToString:  System.Collections.Generic.List`1[System.String]
//    Assembly Qualified Name: System.Collections.Generic.List`1[[System.String, mscor
//    lib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorl
//    ib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: Int32
//    Full Name: System.Int32
//    ToString:  System.Int32
//    Assembly Qualified Name: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutra
//    l, PublicKeyToken=b77a5c561934e089
//
//    Name: IFormatProvider
//    Full Name: System.IFormatProvider
//    ToString:  System.IFormatProvider
//    Assembly Qualified Name: System.IFormatProvider, mscorlib, Version=4.0.0.0, Cult
//    ure=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: NumberFormatInfo
//    Full Name: System.Globalization.NumberFormatInfo
//    ToString:  System.Globalization.NumberFormatInfo
//    Assembly Qualified Name: System.Globalization.NumberFormatInfo, mscorlib, Versio
//    n=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
open System
open System.Globalization

let showTypeInfo (t: Type) =
    printfn $"Name: {t.Name}"
    printfn $"Full Name: {t.FullName}"
    printfn $"ToString:  {t}"
    printfn $"Assembly Qualified Name: {t.AssemblyQualifiedName}\n"

typeof<String>
|> showTypeInfo

(typeof<ResizeArray<_>>).GetGenericTypeDefinition()
|> showTypeInfo

let list = ResizeArray<String>()
list.GetType()
|> showTypeInfo

let v: obj = 12
v.GetType()
|> showTypeInfo

typeof<IFormatProvider>
|> showTypeInfo

let ifmt = NumberFormatInfo.CurrentInfo
ifmt.GetType()
|> showTypeInfo

let o = Some 3
o.GetType()
|> showTypeInfo

// The example displays output like the following:
//    Name: String
//    Full Name: System.String
//    ToString:  System.String
//    Assembly Qualified Name: System.String, mscorlib, Version=4.0.0.0, Culture=neutr
//    al, PublicKeyToken=b77a5c561934e089
//
//    Name: List`1
//    Full Name: System.Collections.Generic.List`1
//    ToString:  System.Collections.Generic.List`1[T]
//    Assembly Qualified Name: System.Collections.Generic.List`1, mscorlib, Version=4.
//    0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: List`1
//    Full Name: System.Collections.Generic.List`1[[System.String, mscorlib, Version=4
//    .0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
//    ToString:  System.Collections.Generic.List`1[System.String]
//    Assembly Qualified Name: System.Collections.Generic.List`1[[System.String, mscor
//    lib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorl
//    ib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: Int32
//    Full Name: System.Int32
//    ToString:  System.Int32
//    Assembly Qualified Name: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutra
//    l, PublicKeyToken=b77a5c561934e089
//
//    Name: IFormatProvider
//    Full Name: System.IFormatProvider
//    ToString:  System.IFormatProvider
//    Assembly Qualified Name: System.IFormatProvider, mscorlib, Version=4.0.0.0, Cult
//    ure=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: NumberFormatInfo
//    Full Name: System.Globalization.NumberFormatInfo
//    ToString:  System.Globalization.NumberFormatInfo
//    Assembly Qualified Name: System.Globalization.NumberFormatInfo, mscorlib, Versio
//    n=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
//
//    Name: FSharpOption`1
//    Full Name: Microsoft.FSharp.Core.FSharpOption`1[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
//    ToString:  Microsoft.FSharp.Core.FSharpOption`1[System.Int32]
//    Assembly Qualified Name: Microsoft.FSharp.Core.FSharpOption`1[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Imports System.Collections.Generic
Imports System.Globalization

Module Example
    Public Sub Main()
        Dim t As Type = GetType(String)
        ShowTypeInfo(t)

        t = GetType(List(Of))
        ShowTypeInfo(t)

        Dim list As New List(Of String)()
        t = list.GetType()
        ShowTypeInfo(t)

        Dim v As Object = 12
        t = v.GetType()
        ShowTypeInfo(t)

        t = GetType(IFormatProvider)
        ShowTypeInfo(t)

        Dim ifmt As IFormatProvider = NumberFormatInfo.CurrentInfo
        t = ifmt.GetType()
        ShowTypeInfo(t)
    End Sub

    Private Sub ShowTypeInfo(t As Type)
        Console.WriteLine($"Name: {t.Name}")
        Console.WriteLine($"Full Name: {t.FullName}")
        Console.WriteLine($"ToString:  {t}")
        Console.WriteLine($"Assembly Qualified Name: {t.AssemblyQualifiedName}")
        Console.WriteLine()
    End Sub
End Module
' The example displays output like the following:
'    Name: String
'    Full Name: System.String
'    ToString:  System.String
'    Assembly Qualified Name: System.String, mscorlib, Version=4.0.0.0, Culture=neutr
'    al, PublicKeyToken=b77a5c561934e089
'
'    Name: List`1
'    Full Name: System.Collections.Generic.List`1
'    ToString:  System.Collections.Generic.List`1[T]
'    Assembly Qualified Name: System.Collections.Generic.List`1, mscorlib, Version=4.
'    0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
'
'    Name: List`1
'    Full Name: System.Collections.Generic.List`1[[System.String, mscorlib, Version=4
'    .0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
'    ToString:  System.Collections.Generic.List`1[System.String]
'    Assembly Qualified Name: System.Collections.Generic.List`1[[System.String, mscor
'    lib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorl
'    ib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
'
'    Name: Int32
'    Full Name: System.Int32
'    ToString:  System.Int32
'    Assembly Qualified Name: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutra
'    l, PublicKeyToken=b77a5c561934e089
'
'    Name: IFormatProvider
'    Full Name: System.IFormatProvider
'    ToString:  System.IFormatProvider
'    Assembly Qualified Name: System.IFormatProvider, mscorlib, Version=4.0.0.0, Cult
'    ure=neutral, PublicKeyToken=b77a5c561934e089
'
'    Name: NumberFormatInfo
'    Full Name: System.Globalization.NumberFormatInfo
'    ToString:  System.Globalization.NumberFormatInfo
'    Assembly Qualified Name: System.Globalization.NumberFormatInfo, mscorlib, Versio
'    n=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

설명

형식의 어셈블리 정규화된 이름은 네임스페이스를 포함한 형식 이름, 쉼표, 어셈블리의 표시 이름으로 구성됩니다. 어셈블리의 표시 이름은 속성을 사용하여 Assembly.FullName 가져옵니다.

참고

프로세서 아키텍처는 어셈블리 ID의 일부이며 어셈블리 이름 문자열의 일부로 지정할 수 있습니다. 예를 들어 "ProcessorArchitecture=msil"입니다. 그러나 호환성을 위해 속성에서 반환하는 AssemblyQualifiedName 문자열에는 포함되지 않습니다. AssemblyName.ProcessorArchitecture을 참조하세요.

공용 언어 런타임을 지원하는 모든 컴파일러에서는 중첩 클래스의 단순 이름을 내보내고, 다음 규칙에 따라 쿼리할 때 리플렉션이 잘못된 이름을 생성합니다.

구분 기호 의미
백슬래시(\) 이스케이프 문자입니다.
쉼표(,) 어셈블리 이름 앞에 입니다.
더하기 기호(+) 중첩 클래스 앞에 섰습니다.
마침표(.) 네임스페이스 식별자를 표시합니다.
대괄호([]) 형식 이름 다음에는 해당 형식의 배열이 표시됩니다.

또는

제네릭 형식의 경우 제네릭 형식 인수 목록을 묶습니다.

또는

형식 인수 목록 내에서 어셈블리 정규화된 형식을 묶습니다.

예를 들어 클래스의 어셈블리 정규화된 이름은 다음과 같습니다.

TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

네임스페이스에 더하기 기호(예: TopNamespace.Sub+Namespace)가 포함된 경우 더하기 기호(+)에 이스케이프 문자(\)가 앞에 와 중첩 구분 기호로 해석되지 않도록 합니다. 리플렉션은 다음과 같이 이 문자열을 내보낸다.

TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

"++"는 "\+\+"가 되고 "\"는 "\\"가 됩니다.

이 정규화된 이름은 유지할 수 있으며 나중에 를 로드 Type하는 데 사용할 수 있습니다. 을 Type검색하고 로드하려면 형식 이름만 사용하거나 어셈블리 정규화된 형식 이름으로 를 사용합니다 GetType . GetType 형식 이름을 사용하면 호출자의 어셈블리에서 및 시스템 어셈블리에서 만 을 찾 Type 습니다. GetType 어셈블리 정규화된 형식 이름을 사용하면 어셈블리에서 을 Type 찾습니다.

형식 이름에는 형식이 참조 형식, 포인터 형식 또는 배열 형식인지 여부와 같이 형식에 대한 추가 정보를 나타내는 후행 문자가 포함될 수 있습니다. 이러한 후행 문자 없이 형식 이름을 검색하려면 를 사용합니다 t.GetElementType().ToString(). 여기서 t 는 형식입니다.

공간은 어셈블리 이름을 제외한 모든 형식 이름 구성 요소에서 관련이 있습니다. 어셈블리 이름에서 ',' 구분 기호 앞의 공백은 관련이 있지만 ',' 구분 기호 뒤의 공백은 무시됩니다.

제네릭 형식의 제네릭 인수는 어셈블리 이름으로 정규화됩니다. 예를 들어 에 대한 MyGenericClass<int> 어셈블리 정규화된 형식 이름(MyGenericClass(Of Integer) Visual Basic의 경우) int 은 의 어셈블리 정규화된 형식 이름으로 Int32확장됩니다.

현재 Type 개체가 제네릭 매개 변수를 나타내는 경우 이 속성은 를 반환합니다 null.

적용 대상

추가 정보