MethodBase.GetMethodFromHandle 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用指定的句柄取得方法資訊。
GetMethodFromHandle(RuntimeMethodHandle) |
使用方法的內部元數據表示法取得方法資訊(handle)。 |
GetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle) |
針對指定的泛型型別,取得由指定句柄表示之建構函式或方法的 MethodBase 物件。 |
使用方法的內部元數據表示法取得方法資訊(handle)。
public:
static System::Reflection::MethodBase ^ GetMethodFromHandle(RuntimeMethodHandle handle);
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle);
public static System.Reflection.MethodBase? GetMethodFromHandle (RuntimeMethodHandle handle);
static member GetMethodFromHandle : RuntimeMethodHandle -> System.Reflection.MethodBase
Public Shared Function GetMethodFromHandle (handle As RuntimeMethodHandle) As MethodBase
參數
- handle
- RuntimeMethodHandle
方法的句柄。
傳回
包含方法相關信息的 MethodBase
。
例外狀況
handle
無效。
備註
句柄只有在取得句柄的應用程式域中才有效。
適用於
.NET 9 和其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
針對指定的泛型型別,取得由指定句柄表示之建構函式或方法的 MethodBase 物件。
public:
static System::Reflection::MethodBase ^ GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
public static System.Reflection.MethodBase? GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
[System.Runtime.InteropServices.ComVisible(false)]
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
static member GetMethodFromHandle : RuntimeMethodHandle * RuntimeTypeHandle -> System.Reflection.MethodBase
[<System.Runtime.InteropServices.ComVisible(false)>]
static member GetMethodFromHandle : RuntimeMethodHandle * RuntimeTypeHandle -> System.Reflection.MethodBase
Public Shared Function GetMethodFromHandle (handle As RuntimeMethodHandle, declaringType As RuntimeTypeHandle) As MethodBase
參數
- handle
- RuntimeMethodHandle
建構函式或方法之內部元數據表示的句柄。
- declaringType
- RuntimeTypeHandle
定義建構函式或方法之泛型型別的句柄。
傳回
MethodBase 物件,表示由 handle
所指定的方法或建構函式,在 declaringType
所指定的泛型型別中。
- 屬性
例外狀況
handle
無效。
備註
句柄只有在取得句柄的應用程式域中才有效。
泛型型別建構函式或方法的 RuntimeMethodHandle 結構可以代表不同的 MethodBase 對象,視泛型型別之型別參數指定的型別而定。 例如,如果 class G<T>
(在 Visual Basic 中為class G(Of T)
,C++ 中的 generic <T> ref class G
) 具有傳回類型 T
的方法,則建構類別中該方法的 MethodBase 物件,例如 G<int>
與泛型型別定義中該方法的 MethodBase 物件不同。
適用於
.NET 9 和其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |