Type.GetTypeFromHandle(RuntimeTypeHandle) Type.GetTypeFromHandle(RuntimeTypeHandle) Type.GetTypeFromHandle(RuntimeTypeHandle) Type.GetTypeFromHandle(RuntimeTypeHandle) Method

Definição

Obtém o tipo referenciado pelo identificador do tipo especificado.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

Parâmetros

handle
RuntimeTypeHandle RuntimeTypeHandle RuntimeTypeHandle RuntimeTypeHandle

O objeto que se refere ao tipo.The object that refers to the type.

Retornos

O tipo referenciado pelo RuntimeTypeHandle especificado ou null, se a propriedade Value de handle for null.The type referenced by the specified RuntimeTypeHandle, or null if the Value property of handle is null.

Exceções

Um inicializador de classe é invocado e lança uma exceção.A class initializer is invoked and throws an exception.

Exemplos

O exemplo a seguir usa GetTypeFromHandle o método para obter Type um objeto GetTypeHandle de RuntimeTypeHandle um fornecido pelo método.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

Comentários

Os identificadores são válidos somente no domínio do aplicativo no qual foram obtidos.The handles are valid only in the application domain in which they were obtained.

Aplica-se a

Veja também