Type.GetTypeFromHandle-Methode
Ruft den Typ ab, auf den das angegebene Typhandle verweist.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Function GetTypeFromHandle ( _
handle As RuntimeTypeHandle _
) As Type
'Usage
Dim handle As RuntimeTypeHandle
Dim returnValue As Type
returnValue = Type.GetTypeFromHandle(handle)
public static Type GetTypeFromHandle (
RuntimeTypeHandle handle
)
public:
static Type^ GetTypeFromHandle (
RuntimeTypeHandle handle
)
public static Type GetTypeFromHandle (
RuntimeTypeHandle handle
)
public static function GetTypeFromHandle (
handle : RuntimeTypeHandle
) : Type
Parameter
- handle
Das RuntimeTypeHandle-Objekt, das auf den Typ verweist.
Rückgabewert
Der Typ, auf den das angegebene RuntimeTypeHandle verweist.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
handle ist NULL (Nothing in Visual Basic). |
|
Ein Klasseninitialisierer wird aufgerufen und löst eine Ausnahme aus. |
Hinweise
Die Handles sind nur in der Anwendungsdomäne gültig, in der sie angefordert wurden.
Diese Methode gibt NULL (Nothing in Visual Basic) zurück, wenn der angeforderte Typ nicht öffentlich ist und der Aufrufer keine ReflectionPermission zum Reflektieren nicht öffentlicher Objekte außerhalb der aktuellen Assembly besitzt.
Beispiel
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
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);
MyClass1^ myClass1 = gcnew MyClass1;
// Get the type referenced by the specified type handle.
Type^ myClass1Type = Type::GetTypeFromHandle( Type::GetTypeHandle( myClass1 ) );
Console::WriteLine( "The Names of the Attributes : {0}", myClass1Type->Attributes );
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.
get_Attributes());
.NET Framework-Sicherheit
- ReflectionPermission zum Reflektieren nicht öffentlicher Objekte. Zugeordnete Enumeration: ReflectionPermissionFlag.TypeInformation
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
Type-Klasse
Type-Member
System-Namespace
RuntimeTypeHandle-Struktur
TypeHandle
GetTypeHandle
ReflectionPermission