Bewerken

Share via


Binder.SelectMethod Method

Definition

Selects a method from the given set of methods, based on the argument type.

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

Parameters

bindingAttr
BindingFlags

A bitwise combination of BindingFlags values.

match
MethodBase[]

The set of methods that are candidates for matching. For example, when a Binder object is used by InvokeMember, this parameter specifies the set of methods that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by DefaultBinder changes the order of this array.

types
Type[]

The parameter types used to locate a matching method.

modifiers
ParameterModifier[]

An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified.

Returns

The matching method, if found; otherwise, null.

Exceptions

For the default binder, match contains multiple methods that are equally good matches for the parameter types described by types. For example, the array in types contains a Type object for MyClass and the array in match contains a method that takes a base class of MyClass and a method that takes an interface that MyClass implements.

For the default binder, match is null or an empty array.

-or-

An element of types derives from Type, but is not of type RuntimeType.

Remarks

This method should return null if no method matches the criteria. This method controls the selection provided by the GetConstructor and GetMethod methods on Type.

Applies to