Type.GetTypeFromHandle(RuntimeTypeHandle) Metodo
Definizione
Ottiene il tipo a cui fa riferimento l'handle del tipo specificato.Gets the type referenced by the specified type 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.The object that refers to the type.
Restituisce
Tipo al quale l'oggetto RuntimeTypeHandle specificato fa riferimento, oppure null
se la proprietà Value di handle
è null
.The type referenced by the specified RuntimeTypeHandle, or null
if the Value property of handle
is null
.
Eccezioni
Viene richiamato un inizializzatore di classi e viene generata un'eccezione.A class initializer is invoked and throws an exception.
Esempio
Nell'esempio seguente viene usato il GetTypeFromHandle metodo per ottenere un Type oggetto da un oggetto RuntimeTypeHandle fornito GetTypeHandle dal metodo.The following example uses the GetTypeFromHandle method to get a Type object from a RuntimeTypeHandle provided by the GetTypeHandle method.
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);
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 dell'applicazione in cui sono stati ottenuti.The handles are valid only in the application domain in which they were obtained.