_Type.GetMethod _Type.GetMethod _Type.GetMethod _Type.GetMethod Method

定义

为 COM 对象提供对 GetMethod 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod method.

重载

GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[])

为 COM 对象提供对 GetMethod(String, Type[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, Type[]) method.

GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) method.

GetMethod(String) GetMethod(String) GetMethod(String) GetMethod(String)

为 COM 对象提供对 GetMethod(String) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String) method.

GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags)

为 COM 对象提供对 GetMethod(String, BindingFlags) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags) method.

GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, Type[], ParameterModifier[]) method.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod 方法。The Type.GetMethod method.

GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[])

为 COM 对象提供对 GetMethod(String, Type[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, Type[]) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.MethodInfo GetMethod (string name, Type[] types);
abstract member GetMethod : string * Type[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type()) As MethodInfo

参数

name
String String String String

包含要获取的公共方法的名称的 StringThe String containing the name of the public method to get.

types
Type[]

表示此方法要获取的参数的个数、顺序和类型的 Type 对象数组。An array of Type objects representing the number, order, and type of the parameters for the method to get.

- 或 --or- 一个类型为 Type(即 Type[] types = new Type[0])的空数组,用于获取一个不带参数的方法。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

返回

表示其参数与指定参数类型匹配的公共方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the public method whose parameters match the specified argument types, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索其参数与指定的参数类型匹配的指定公共方法。The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types.

GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, System::Reflection::CallingConventions callConvention, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.MethodInfo GetMethod (string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo

参数

name
String String String String

包含要获取的方法名称的 StringThe String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or- 零,以返回 nullZero, to return null.

binder
Binder Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

- 或 --or- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

callConvention
CallingConventions CallingConventions CallingConventions CallingConventions

CallingConventions 对象用于指定要使用的一套规则,这些规则涉及自变量的顺序和布局、传递返回值的方式、用于自变量的寄存器和清理堆栈的方式。The CallingConventions object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and how the stack is cleaned up.

types
Type[]

表示此方法要获取的参数的个数、顺序和类型的 Type 对象数组。An array of Type objects representing the number, order, and type of the parameters for the method to get.

- 或 --or- 一个类型为 Type(即 Type[] types = new Type[0])的空数组,用于获取一个不带参数的方法。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 对象的数组,表示与 types 数组中的相应元素关联的特性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 默认的联编程序不处理此参数。The default binder does not process this parameter.

返回

表示符合指定要求的方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索其参数与指定的参数类型及修饰符,使用指定的绑定约束和指定的调用约定匹配的指定方法。The Type.GetMethod method searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.MethodInfo GetMethod (string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo

参数

name
String String String String

包含要获取的方法名称的 StringThe String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

- 或 --or- 零,以返回 nullZero, to return null.

binder
Binder Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

- 或 --or- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

types
Type[]

表示此方法要获取的参数的个数、顺序和类型的 Type 对象数组。An array of Type objects representing the number, order, and type of the parameters for the method to get.

- 或 --or- 一个类型为 Type(即 Type[] types = new Type[0])的空数组,用于获取一个不带参数的方法。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 对象的数组,表示与 types 数组中的相应元素关联的特性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 默认的联编程序不处理此参数。The default binder does not process this parameter.

返回

表示符合指定要求的方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索其参数与指定的参数类型及修饰符,使用指定的绑定约束匹配的指定方法。The Type.GetMethod method searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetMethod(String) GetMethod(String) GetMethod(String) GetMethod(String)

为 COM 对象提供对 GetMethod(String) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name);
public System.Reflection.MethodInfo GetMethod (string name);
abstract member GetMethod : string -> System.Reflection.MethodInfo
Public Function GetMethod (name As String) As MethodInfo

参数

name
String String String String

包含要获取的公共方法的名称的 StringThe String containing the name of the public method to get.

返回

表示具有指定名称的公共方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the public method with the specified name, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索具有指定名称的公共方法。The Type.GetMethod method searches for the public method with the specified name.

GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags)

为 COM 对象提供对 GetMethod(String, BindingFlags) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public System.Reflection.MethodInfo GetMethod (string name, System.Reflection.BindingFlags bindingAttr);
abstract member GetMethod : string * System.Reflection.BindingFlags -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, bindingAttr As BindingFlags) As MethodInfo

参数

name
String String String String

包含要获取的方法名称的 StringThe String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or- 零,以返回 nullZero, to return null.

返回

表示符合指定要求的方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索指定的方法,使用指定的绑定约束。The Type.GetMethod method searches for the specified method, using the specified binding constraints.

GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[])

为 COM 对象提供对 GetMethod(String, Type[], ParameterModifier[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetMethod(String, Type[], ParameterModifier[]) method.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.MethodInfo GetMethod (string name, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetMethod : string * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type(), modifiers As ParameterModifier()) As MethodInfo

参数

name
String String String String

包含要获取的公共方法的名称的 StringThe String containing the name of the public method to get.

types
Type[]

表示此方法要获取的参数的个数、顺序和类型的 Type 对象数组。An array of Type objects representing the number, order, and type of the parameters for the method to get.

-or- 一个类型为 Type(即 Type[] types = new Type[0])的空数组,用于获取一个不带参数的方法。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 对象的数组,表示与 types 数组中的相应元素关联的特性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 默认的联编程序不处理此参数。The default binder does not process this parameter.

返回

表示符合指定要求的公共方法的 MethodInfo 对象(如果找到的话);否则为 nullA MethodInfo object representing the public method that matches the specified requirements, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法搜索其参数与指定的参数类型及修饰符匹配的指定公共方法。The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types and modifiers.

适用于