Type.Assembly 속성

정의

형식이 선언되는 Assembly를 가져옵니다. 제네릭 형식의 경우 제네릭 형식이 정의되는 Assembly를 가져옵니다.

public:
 abstract property System::Reflection::Assembly ^ Assembly { System::Reflection::Assembly ^ get(); };
public abstract System.Reflection.Assembly Assembly { get; }
member this.Assembly : System.Reflection.Assembly
Public MustOverride ReadOnly Property Assembly As Assembly

속성 값

현재 형식이 포함된 어셈블리를 설명하는 Assembly 인스턴스입니다. 제네릭 형식의 경우 인스턴스는 특정한 생성된 형식을 만들고 사용하는 어셈블리가 아니라 제네릭 형식 정의가 포함된 어셈블리를 설명합니다.

구현

예제

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

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.

설명

현재 Type 개체가 생성된 제네릭 형식을 나타내는 경우 이 속성은 제네릭 형식 정의가 포함된 어셈블리를 반환합니다. 예를 들어 제네릭 형식 정의 MyGenericStack<T> (MyGenericStack(Of T) Visual Basic generic<T> ref class MyGenericStack 의 경우 C++)를 포함하는 MyGenerics.dll 라는 어셈블리를 만듭니다. 인스턴스를 MyGenericStack<int> 만드는 경우 (MyGenericStack(Of Integer) Visual Basic에서) 다른 어셈블리 Assembly 에서 생성 된 형식에 대 한 Assembly 속성은 MyGenerics.dll 나타내는 개체를 반환 합니다.

마찬가지로 현재 Type 개체가 할당되지 않은 제네릭 매개 변수 T를 나타내는 경우 이 속성은 를 정의하는 제네릭 형식이 포함된 어셈블리를 반환합니다 T.

Type.Assembly.NET Core 또는 유니버설 Windows 플랫폼 같은 특정 .NET 구현에서 속성을 사용할 수 없는 경우 속성을 대신 사용합니다TypeInfo.Assembly.

이 속성은 읽기 전용입니다.

적용 대상