Share via


Type.AssemblyQualifiedName プロパティ

Type の読み込み元であるアセンブリの名前を含む、 Type の完全限定名を取得します。

Public MustOverride ReadOnly Property AssemblyQualifiedName As _
   String
[C#]
public abstract string AssemblyQualifiedName {get;}
[C++]
public: __property virtual String* get_AssemblyQualifiedName() = 0;
[JScript]
public abstract function get AssemblyQualifiedName() : String;

プロパティ値

Type の読み込み元であるアセンブリの名前を含む、 Type の完全限定名。

解説

入れ子になったクラスに対して、共通言語ランタイムをサポートするすべてのコンパイラは簡易名を生成し、リフレクションが、照会されたときに次の規則に従って完全限定名を生成します。

区切り記号 意味
円記号 (\) エスケープ文字。
コンマ (,) アセンブリ名の前に置きます。
プラス記号 (+) 入れ子になったクラスの前に置きます。
ピリオド (.) 名前空間識別子を示します。

たとえば、クラスの完全限定名は次のようになります。

TopNamespace.SubNameSpace.ContainingClass+NestedClass,MyAssembly

名前空間が TopNamespace.Sub+Namespace である場合、プラス記号 (+) が、入れ子になったクラスの区切り文字として解釈されないように、プラス記号 (+) の前にエスケープ文字 (\) を付ける必要があります。リフレクションは、この文字列を次のように生成します。

TopNamespace.Sub\+Namespace.ContainingClass+NestedClass,MyAssembly

"++" は "\+\+"、"\" は "\\" となります。

この完全限定名は永続化でき、後で Type を読み込むために使用できます。 Type を検索して読み込むには、型名だけ、またはアセンブリ限定型名のいずれかを指定して GetType を使用します。型名だけを指定して GetType を使用した場合は、呼び出し元のアセンブリの Type だけが検索され、次に System アセンブリが検索されます。アセンブリ限定型名を指定して GetType を使用した場合は、任意のアセンブリ内の Type が検索されます。

型名の末尾には、その型に関する追加情報を示す文字を追加できます。たとえば、その型が参照型か、ポインタ型か、配列型かなどを表す文字を追加できます。このような末尾の文字を除いて型名だけを取得するには、 t.GetElementType().ToString() を使用します。 t が型を示します。

アセンブリ名を除くすべての型名コンポーネントで、スペースには意味があります。アセンブリ名では、区切り記号 ',' の前のスペースには意味がありますが、区切り記号 ',' の後のスペースは無視されます。

使用例

[Visual Basic, C#, C++] クラスに関連付けられたアセンブリ名とその型の完全限定名を表示する例を次に示します。

 
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Class MyAssemblyClass
    Public Shared Sub Main()
        Dim objType As Type = GetType(System.Array)
        ' Print the full assembly name.
        Console.WriteLine("Full assembly name: {0}.", objType.Assembly.FullName.ToString())
        ' Print the qualified assembly name.
        Console.WriteLine("Qualified assembly name: {0}.", objType.AssemblyQualifiedName.ToString())
    End Sub 'Main
End Class 'MyAssemblyClass

[C#] 
using System;
using System.Reflection;

class MyAssemblyClass
{

    public static void Main()
    {
        Type objType = typeof(System.Array);
                    
        // Print the full assembly name.
        Console.WriteLine ("Full assembly name: {0}.", objType.Assembly.FullName.ToString()); 

        // Print the qualified assembly name.
        Console.WriteLine ("Qualified assembly name: {0}.", objType.AssemblyQualifiedName.ToString()); 
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;
int main() {
   Type*  objType = __typeof(System::Array);

   // Print the full assembly name.
   Console::WriteLine (S"Full assembly name: {0}.", objType->Assembly->FullName); 

   // Print the qualified assembly name.
   Console::WriteLine (S"Qualified assembly name: {0}.", objType->AssemblyQualifiedName); 
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, Common Language Infrastructure (CLI) Standard

参照

Type クラス | Type メンバ | System 名前空間 | String | GetType | FullName | Namespace | 完全限定型名の指定 | AssemblyName