Type.GetTypeFromHandle(RuntimeTypeHandle) Metodo

Definizione

Ottiene il tipo a cui fa riferimento l'handle di tipo specificato.

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

Parametri

handle
RuntimeTypeHandle

Oggetto che fa riferimento al tipo.

Valori restituiti

Tipo a cui fa riferimento l'oggetto specificato RuntimeTypeHandleoppure null se la Value proprietà di handle è null.

Eccezioni

Un inizializzatore di classe viene richiamato e genera un'eccezione.

Esempio

Nell'esempio seguente viene utilizzato il GetTypeFromHandle metodo per ottenere un Type oggetto da un RuntimeTypeHandle oggetto fornito dal GetTypeHandle metodo .

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

Commenti

Gli handle sono validi solo nel dominio applicazione in cui sono stati ottenuti.

Si applica a

Vedi anche