Binder.SelectMethod 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
根据参数类型从给定的方法集中选择一个方法。
public:
abstract System::Reflection::MethodBase ^ SelectMethod(System::Reflection::BindingFlags bindingAttr, cli::array <System::Reflection::MethodBase ^> ^ match, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public abstract System.Reflection.MethodBase? SelectMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, Type[] types, System.Reflection.ParameterModifier[]? modifiers);
public abstract System.Reflection.MethodBase SelectMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member SelectMethod : System.Reflection.BindingFlags * System.Reflection.MethodBase[] * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodBase
Public MustOverride Function SelectMethod (bindingAttr As BindingFlags, match As MethodBase(), types As Type(), modifiers As ParameterModifier()) As MethodBase
参数
- bindingAttr
- BindingFlags
值的按位组合 BindingFlags 。
- match
- MethodBase[]
适合匹配的方法集。 例如,使用对象Binder时InvokeMember,此参数指定反射确定为可能的匹配项的方法集,通常是因为它们具有正确的成员名称。 通过 DefaultBinder 更改此数组的顺序提供的默认实现。
- types
- Type[]
用于查找匹配方法的参数类型。
- modifiers
- ParameterModifier[]
一个参数修饰符数组,它使绑定能够处理在其中修改了类型的参数签名。
返回
如果找到匹配的方法,则为否则,为 null.
例外
对于默认联编程序, match 包含多个方法,这些方法与所 types描述的参数类型相同。 例如,数组包含 types 对象的 Type 对象 MyClass 和数组中的 match 一个方法,该方法采用基类 MyClass 和一个采用实现接口 MyClass 的方法。
注解
如果没有与条件匹配的方法,则此方法应返回 null 。 此方法控制其 GetConstructor 上提供的选定内容和 GetMethod 方法 Type。