IReflect.GetMethod 方法

定義

擷取 MethodInfo 對應特定方法的物件。

多載

名稱 Description
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

用於控制搜尋的綁定屬性。

binder
Binder

一個實作 Binder的物件,包含與此方法相關的屬性。

types
Type[]

一個用於選擇超載方法的陣列。

modifiers
ParameterModifier[]

一組參數修飾器陣列,用來使綁定能與參數簽名相符,其中類型已被修改。

傳回

所請求的方法,必須符合所有指定參數。

例外狀況

該物件實作多個同名的方法。

備註

回傳值是基於方法名稱、 BindingFlags 列舉成員、參數指定的 binder 型別轉換類型、超載,以及描述方法簽名的 所 ParameterInfo 匹配的。

另請參閱

適用於