Type.GetTypeFromHandle(RuntimeTypeHandle) Метод

Определение

Возвращает тип, на который ссылается дескриптор указанного типа.

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

Параметры

handle
RuntimeTypeHandle

Объект, ссылающийся на тип.

Возвращаемое значение

Тип, на который ссылается указанный RuntimeTypeHandleобъект, или nullValue если свойство handle имеет значение null.

Исключения

Инициализатор класса вызывается и вызывает исключение.

Примеры

В следующем примере метод используется GetTypeFromHandle для получения Type объекта из предоставленного RuntimeTypeHandle методом GetTypeHandle .

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

Комментарии

Дескриптор действителен только в домене приложения, в котором они были получены.

Применяется к

См. также раздел