Share via


Type.GetTypeFromHandle メソッド

指定した型ハンドルによって参照される型を取得します。

Public Shared Function GetTypeFromHandle( _
   ByVal handle As RuntimeTypeHandle _) As Type
[C#]
public static Type GetTypeFromHandle(RuntimeTypeHandlehandle);
[C++]
public: static Type* GetTypeFromHandle(RuntimeTypeHandlehandle);
[JScript]
public static function GetTypeFromHandle(
   handle : RuntimeTypeHandle) : Type;

パラメータ

戻り値

指定した RuntimeTypeHandle によって参照される型。

例外

例外の種類 条件
ArgumentNullException handle が null 参照 (Visual Basic では Nothing) です。
TargetInvocationException クラス初期化子が呼び出され、例外をスローしました。

解説

ハンドルは取得されたアプリケーション ドメインでだけ有効です。

要求された型がパブリックではなく、呼び出し元に現在のアセンブリ外の非パブリック オブジェクトをリフレクションするための ReflectionPermission がない場合、このメソッドは null 参照 (Visual Basic では Nothing) を返します。

使用例

 
Dim myClass1 As New MyClass1()
' Get the type referenced by the specified type handle.
Dim myClass1Type As Type = Type.GetTypeFromHandle(Type.GetTypeHandle(MyClass1))
Console.WriteLine(("The Names of the Attributes :" + myClass1Type.Attributes.ToString()))
   End Sub 'Main 

[C#] 
MyClass1 myClass1 = new MyClass1();
 // Get the type referenced by the specified type handle.
Type myClass1Type = Type.GetTypeFromHandle(Type.GetTypeHandle(myClass1));
Console.WriteLine("The Names of the Attributes :"+myClass1Type.Attributes);

[C++] 
MyClass1* myClass1 = new MyClass1();
// Get the type referenced by the specified type handle.
Type*  myClass1Type = Type::GetTypeFromHandle(Type::GetTypeHandle(myClass1));
Console::WriteLine(S"The Names of the Attributes : {0}",__box( myClass1Type->Attributes));

[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 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

.NET Framework セキュリティ:

参照

Type クラス | Type メンバ | System 名前空間 | RuntimeTypeHandle | TypeHandle | GetTypeHandle | ReflectionPermission