Module.GetMethod 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳一個具有指定條件的方法。
多載
| 名稱 | Description |
|---|---|
| GetMethod(String) |
回傳一個名稱相同的方法。 |
| GetMethod(String, Type[]) |
回傳一個具有指定名稱與參數類型的方法。 |
| GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
回傳一個包含指定名稱、綁定資訊、呼叫慣例,以及參數類型與修飾符的方法。 |
GetMethod(String)
回傳一個名稱相同的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name);
public System.Reflection.MethodInfo GetMethod(string name);
member this.GetMethod : string -> System.Reflection.MethodInfo
Public Function GetMethod (name As String) As MethodInfo
參數
- name
- String
方法名稱。
傳回
物件名稱 MethodInfo 為指定名稱,或 null 是該方法不存在。
例外狀況
name 是 null。
適用於
GetMethod(String, Type[])
回傳一個具有指定名稱與參數類型的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.MethodInfo GetMethod(string name, Type[] types);
member this.GetMethod : string * Type[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type()) As MethodInfo
參數
- name
- String
方法名稱。
- types
- Type[]
要搜尋的參數類型。
傳回
根據指定標準null,或是該方法不存在,則是物件MethodInfo。
例外狀況
name是,是,或types(i)是null。nulltypesnull
適用於
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
回傳一個包含指定名稱、綁定資訊、呼叫慣例,以及參數類型與修飾符的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, System::Reflection::CallingConventions callConvention, 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, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers);
member this.GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, bindingAttr As BindingFlags, binder As Binder, callConvention As CallingConventions, types As Type(), modifiers As ParameterModifier()) As MethodInfo
參數
- name
- String
方法名稱。
- bindingAttr
- BindingFlags
BindingFlags其中一個位元標誌用來控制搜尋。
- binder
- Binder
一個實作 Binder的物件,包含與此方法相關的屬性。
- callConvention
- CallingConventions
方法的呼叫慣例。
- types
- Type[]
要搜尋的參數類型。
- modifiers
- ParameterModifier[]
一組參數修飾器陣列,用來使綁定能與參數簽名相符,其中類型已被修改。
傳回
根據指定標準null,或是該方法不存在,則是物件MethodInfo。
例外狀況
name是,是,或types(i)是null。nulltypesnull