Type.AssemblyQualifiedName 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 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.
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 , FullName 및 속성이 반환 하는 문자열을 비교 합니다 AssemblyQualifiedName .
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
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 속성입니다.
참고
.NET Framework 버전 2.0에서는 프로세서 아키텍처가 어셈블리 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 합니다.