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);
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 的方法。

如果是預設繫結器 (Binder),match 會是 null 或空白陣列。

-或-

types 的一個項目衍生自 Type,但不是 RuntimeType 型別。

備註

如果沒有符合準則的方法,這個方法應該會傳回 null 。 這個方法會控制 上 TypeGetMethod 方法所提供的 GetConstructor 選取範圍。

適用於