Type.GetTypeFromHandle(RuntimeTypeHandle) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan jenis yang dirujuk oleh handel jenis yang ditentukan.
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
Parameter
- handle
- RuntimeTypeHandle
Objek yang mengacu pada jenis .
Mengembalikan
Jenis yang dirujuk oleh , atau RuntimeTypeHandle jika null properti yang Value ditentukan handleadalah null.
Pengecualian
Penginisialisasi kelas dipanggil dan melemparkan pengecualian.
Contoh
Contoh berikut menggunakan GetTypeFromHandle metode untuk mendapatkan Type objek dari yang RuntimeTypeHandle disediakan oleh GetTypeHandle metode .
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
Keterangan
Handel hanya valid di domain aplikasi tempat mereka diperoleh.