Type.GetTypeFromHandle(RuntimeTypeHandle) Methode

Definitie

Hiermee wordt het type opgehaald waarnaar wordt verwezen door de opgegeven typegreep.

public:
 static Type ^ GetTypeFromHandle(RuntimeTypeHandle handle);
public static Type GetTypeFromHandle(RuntimeTypeHandle handle);
static member GetTypeFromHandle : RuntimeTypeHandle -> Type
Public Shared Function GetTypeFromHandle (handle As RuntimeTypeHandle) As Type

Parameters

handle
RuntimeTypeHandle

Het object dat naar het type verwijst.

Retouren

Het type waarnaar wordt verwezen door de opgegeven , of null als de Value eigenschap is nullhandle .RuntimeTypeHandle

Uitzonderingen

Er wordt een klasse-initializer aangeroepen en er wordt een uitzondering gegenereerd.

Voorbeelden

In het volgende voorbeeld wordt de GetTypeFromHandle methode gebruikt om een Type object op te halen uit een RuntimeTypeHandle door de GetTypeHandle methode opgegeven.

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);
let myClass1 = MyClass1()
// Get the type referenced by the specified type handle.
let myClass1Type = Type.GetTypeFromHandle(Type.GetTypeHandle myClass1)
printfn $"The Names of the Attributes: {myClass1Type.Attributes}"
   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

Opmerkingen

De ingangen zijn alleen geldig in het toepassingsdomein waarin ze zijn verkregen.

Van toepassing op

Zie ook