Type.GetTypeFromHandle(RuntimeTypeHandle) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得指定型態 handle 所參考的型別。
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所參考的類型,或 null 若 Value 的 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
備註
這些帳號只在取得它們的應用域中有效。