MethodBase.GetMethodFromHandle 方法

定义

使用指定句柄获取方法信息。Gets method information using the specified handle.

重载

GetMethodFromHandle(RuntimeMethodHandle)

通过使用方法的内部元数据表示形式(句柄)获取方法信息。Gets method information by using the method's internal metadata representation (handle).

GetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle)

以指定泛型类型,获取指定句柄所表示的构造函数或方法的 MethodBase 对象。Gets a MethodBase object for the constructor or method represented by the specified handle, for the specified generic type.

GetMethodFromHandle(RuntimeMethodHandle)

通过使用方法的内部元数据表示形式(句柄)获取方法信息。Gets method information by using the method's internal metadata representation (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

方法的句柄。The method's handle.

返回

MethodBase,包含方法的有关信息。A MethodBase containing information about the method.

异常

handle 无效。handle is invalid.

注解

句柄仅在获取它们的应用程序域中有效。Handles are valid only in the application domain in which they were obtained.

安全性

ReflectionPermission
当通过 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])的机制后期绑定调用时。when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). 关联的枚举:MemberAccessAssociated enumeration: MemberAccess.

GetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle)

以指定泛型类型,获取指定句柄所表示的构造函数或方法的 MethodBase 对象。Gets a MethodBase object for the constructor or method represented by the specified handle, for the specified generic type.

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
Public Shared Function GetMethodFromHandle (handle As RuntimeMethodHandle, declaringType As RuntimeTypeHandle) As MethodBase

参数

handle
RuntimeMethodHandle

构造函数或方法的内部元数据表示形式的句柄。A handle to the internal metadata representation of a constructor or method.

declaringType
RuntimeTypeHandle

定义构造函数或方法的泛型类型的句柄。A handle to the generic type that defines the constructor or method.

返回

MethodBase 对象,表示由 handle 指定的方法或构造函数,为由 declaringType 指定的泛型类型。A MethodBase object representing the method or constructor specified by handle, in the generic type specified by declaringType.

属性

异常

handle 无效。handle is invalid.

注解

句柄仅在获取它们的应用程序域中有效。Handles are valid only in the application domain in which they were obtained.

泛型类型的构造函数或方法的 RuntimeMethodHandle 结构可以表示不同的 MethodBase 对象,具体取决于为泛型类型的类型参数指定的类型。A RuntimeMethodHandle structure for a constructor or method of a generic type can represent different MethodBase objects, depending on the types specified for the type parameters of the generic type. 例如,如果 class G<T> (中的class G(Of T) Visual Basic,generic <T> ref class G 中C++的)具有返回类型 T的方法,则构造类(如 MethodBase)中该方法的 G<int> 对象不同于泛型类型定义中该方法的 MethodBase 对象。For example, if class G<T> (class G(Of T) in Visual Basic, generic <T> ref class G in C++) has a method that returns type T, the MethodBase object for that method in a constructed class such as G<int> is different from the MethodBase object for that method in the generic type definition.

安全性

ReflectionPermission
当通过 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])的机制后期绑定调用时。when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). 关联的枚举:MemberAccessAssociated enumeration: MemberAccess.

适用于