Type.GetTypeFromHandle(RuntimeTypeHandle) Metoda

Definicja

Pobiera typ, do których odwołuje się określony uchwyt typu.

public:
 static Type ^ GetTypeFromHandle(RuntimeTypeHandle handle);
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

Parametry

handle
RuntimeTypeHandle

Obiekt, który odwołuje się do typu.

Zwraca

Typ, do który odwołuje się określony RuntimeTypeHandleelement , lub null jeśli Value właściwość ma nullhandle wartość .

Wyjątki

Inicjator klasy jest wywoływany i zgłasza wyjątek.

Przykłady

W poniższym przykładzie użyto GetTypeFromHandle metody , aby pobrać Type obiekt z obiektu dostarczonego RuntimeTypeHandle przez metodę GetTypeHandle .

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.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

Uwagi

Uchwyty są prawidłowe tylko w domenie aplikacji, w której zostały uzyskane.

Dotyczy

Zobacz też