IReflect.GetMethod 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
MethodInfo检索与指定方法对应的对象。
重载
| 名称 | 说明 |
|---|---|
| GetMethod(String, BindingFlags) |
MethodInfo检索与指定搜索约束下指定方法对应的对象。 |
| GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) |
MethodInfo检索与指定方法对应的对象,该对象使用Type数组从重载方法中进行选择。 |
GetMethod(String, BindingFlags)
MethodInfo检索与指定搜索约束下指定方法对应的对象。
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
要查找的成员的名称。
- bindingAttr
- BindingFlags
用于控制搜索的绑定属性。
返回
一个 MethodInfo 包含方法信息的对象,匹配项基于在 中指定的 bindingAttr方法名称和搜索约束。
例外
该对象实现多个具有相同名称的方法。
另请参阅
适用于
GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])
MethodInfo检索与指定方法对应的对象,该对象使用Type数组从重载方法中进行选择。
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
Public Function GetMethod (name As String, bindingAttr As BindingFlags, binder As Binder, types As Type(), modifiers As ParameterModifier()) As MethodInfo
参数
- name
- String
要查找的成员的名称。
- bindingAttr
- BindingFlags
用于控制搜索的绑定属性。
- types
- Type[]
用于在重载方法之间进行选择的数组。
- modifiers
- ParameterModifier[]
一个参数修饰符数组,用于使绑定能够处理已修改类型的参数签名。
返回
与所有指定参数匹配的请求方法。
例外
该对象实现多个具有相同名称的方法。
注解
返回值是基于方法名称、 BindingFlags 枚举成员、参数指定的 binder 类型转换类型、重载和 ParameterInfo 描述方法签名的匹配项。