_Type.GetMethod 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 COM 物件對該方法的版本無關存取 GetMethod 權。
多載
| 名稱 | Description |
|---|---|
| GetMethod(String, Type[]) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String, Type[]) 權。 |
| GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 權。 |
| GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 權。 |
| GetMethod(String) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String) 權。 |
| GetMethod(String, BindingFlags) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String, BindingFlags) 權。 |
| GetMethod(String, Type[], ParameterModifier[]) |
提供 COM 物件對該方法的版本無關存取 GetMethod(String, Type[], ParameterModifier[]) 權。 |
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
Type.GetMethod 方法。
GetMethod(String, Type[])
提供 COM 物件對該方法的版本無關存取 GetMethod(String, Type[]) 權。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.MethodInfo GetMethod(string name, Type[] types);
abstract member GetMethod : string * Type[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type()) As MethodInfo
參數
- types
- Type[]
Type 對象的陣列,表示要取得之方法的參數數目、順序和類型。
-或者-
一個空陣列的 類型 Type (即 Type[] types = new Type[0]),以獲得一個不接受參數的方法。
傳回
表示 MethodInfo 公開方法的物件,其參數與指定的參數類型相符(若找到);否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會搜尋指定的公開方法,其參數與指定參數類型相符。
適用於
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
提供 COM 物件對該方法的版本無關存取 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);
abstract member 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
參數
- callConvention
- CallingConventions
指定 CallingConventions 參數順序與佈局、回傳值傳遞方式、參數暫存器及堆疊清理方式的規則集合。
- types
- Type[]
Type 對象的陣列,表示要取得之方法的參數數目、順序和類型。
-或者-
一個空陣列的 類型 Type (即 Type[] types = new Type[0]),以獲得一個不接受參數的方法。
- modifiers
- ParameterModifier[]
一個代表陣列中對應元素ParameterModifier屬性的物件陣列types。 預設的綁定器不會處理這個參數。
傳回
MethodInfo若找到符合指定需求的方法物件;否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會利用指定的綁定約束和呼叫慣例,搜尋其參數與參數與修飾符相符的指定方法。
適用於
GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])
提供 COM 物件對該方法的版本無關存取 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 權。
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
參數
- types
- Type[]
Type 對象的陣列,表示要取得之方法的參數數目、順序和類型。
-或者-
一個空陣列的 類型 Type (即 Type[] types = new Type[0]),以獲得一個不接受參數的方法。
- modifiers
- ParameterModifier[]
一個代表陣列中對應元素ParameterModifier屬性的物件陣列types。 預設的綁定器不會處理這個參數。
傳回
MethodInfo若找到符合指定需求的方法物件;否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會利用指定的綁定約束,搜尋其參數與指定參數類型及修飾符相符的方法。
適用於
GetMethod(String)
提供 COM 物件對該方法的版本無關存取 GetMethod(String) 權。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name);
public System.Reflection.MethodInfo GetMethod(string name);
abstract member GetMethod : string -> System.Reflection.MethodInfo
Public Function GetMethod (name As String) As MethodInfo
參數
傳回
若找到,則代表 MethodInfo 具有指定名稱的公開方法物件;否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會搜尋具有指定名稱的公開方法。
適用於
GetMethod(String, BindingFlags)
提供 COM 物件對該方法的版本無關存取 GetMethod(String, BindingFlags) 權。
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
參數
傳回
MethodInfo若找到符合指定需求的方法物件;否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會利用指定的綁定約束來搜尋指定的方法。
適用於
GetMethod(String, Type[], ParameterModifier[])
提供 COM 物件對該方法的版本無關存取 GetMethod(String, Type[], ParameterModifier[]) 權。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
public System.Reflection.MethodInfo GetMethod(string name, Type[] types, System.Reflection.ParameterModifier[] modifiers);
abstract member GetMethod : string * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type(), modifiers As ParameterModifier()) As MethodInfo
參數
- types
- Type[]
Type 對象的陣列,表示要取得之方法的參數數目、順序和類型。
-或者-
一個空陣列的 類型 Type (即 Type[] types = new Type[0]),以獲得一個不接受參數的方法。
- modifiers
- ParameterModifier[]
一個代表陣列中對應元素ParameterModifier屬性的物件陣列types。 預設的綁定器不會處理這個參數。
傳回
MethodInfo一個代表公用方法且符合指定需求的物件(若找到);否則,為 null。
備註
此方法用於從非受管理程式碼存取受管理類別,不應從受管理程式碼呼叫。
該 Type.GetMethod 方法會搜尋指定的公開方法,其參數與指定的參數類型與修飾符相符。