Module.GetMethod Module.GetMethod Module.GetMethod Module.GetMethod Method

定义

返回具有指定条件的方法。Returns a method having the specified criteria.

重载

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

返回具有指定名称的方法。Returns a method having the specified name.

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

返回具有指定名称和参数类型的方法。Returns a method having the specified name and parameter types.

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

返回具有指定名称、绑定信息、调用约定和参数类型及修饰符的方法。Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.

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

返回具有指定名称的方法。Returns a method having the specified name.

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

参数

name
String String String String

方法名。The method name.

返回

具有指定名称的 MethodInfo 对象,如果该方法不存在则为 nullA MethodInfo object having the specified name, or null if the method does not exist.

异常

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

返回具有指定名称和参数类型的方法。Returns a method having the specified name and parameter types.

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

参数

name
String String String String

方法名。The method name.

types
Type[]

要搜索的参数类型。The parameter types to search for.

返回

一个符合指定条件的 MethodInfo 对象,如果方法不存在则为 nullA MethodInfo object in accordance with the specified criteria, or null if the method does not exist.

异常

namenulltypesnull,或 types (i) 为 nullname is null, types is null, or types (i) is null.

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

返回具有指定名称、绑定信息、调用约定和参数类型及修饰符的方法。Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.

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);
member this.GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo

参数

name
String String String String

方法名。The method name.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

用来控制搜索的其中一个 BindingFlags 位标志。One of the BindingFlags bit flags used to control the search.

binder
Binder Binder Binder Binder

一个实现 Binder 的对象,包含与此方法相关的属性。An object that implements Binder, containing properties related to this method.

callConvention
CallingConventions CallingConventions CallingConventions CallingConventions

方法的调用约定。The calling convention for the method.

types
Type[]

要搜索的参数类型。The parameter types to search for.

modifiers
ParameterModifier[]

参数修饰符的数组,用于使绑定可与在其中修改了类型的参数签名一起使用。An array of parameter modifiers used to make binding work with parameter signatures in which the types have been modified.

返回

一个符合指定条件的 MethodInfo 对象,如果方法不存在则为 nullA MethodInfo object in accordance with the specified criteria, or null if the method does not exist.

异常

namenulltypesnull,或 types (i) 为 nullname is null, types is null, or types (i) is null.

另请参阅

适用于