Binder.SelectMethod 方法

定義

根據參數類型,從給定的方法集合中選擇一個方法。

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);
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 包含 TypeMyClass 物件,而 中的 match 陣列包含一個取 的 MyClass 基底類別的方法,以及一個實作 的介面 MyClass 方法。

預設綁定器則是 matchnull 空陣列。

-或者-

元素 typesType衍生,但不屬於類型 RuntimeType

備註

若無符合條件的方法,此方法應回傳 null 。 此方法控制 與 GetMethod 方法在 GetConstructor 上的Type選擇。

適用於