_Type.GetMethod _Type.GetMethod _Type.GetMethod _Type.GetMethod Method

定義

為 COM 物件提供與版本無關的 GetMethod 方法之存取權。Provides COM objects with version-independent access to the GetMethod method.

多載

GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[])

為 COM 物件提供與版本無關的 GetMethod(String, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, Type[]) method.

GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) method.

GetMethod(String) GetMethod(String) GetMethod(String) GetMethod(String)

為 COM 物件提供與版本無關的 GetMethod(String) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String) method.

GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags)

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags) method.

GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, Type[], ParameterModifier[]) method.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod 方法The Type.GetMethod method.

GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[]) GetMethod(String, Type[])

為 COM 物件提供與版本無關的 GetMethod(String, Type[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, Type[]) method.

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

參數

name
String String String String

String,包含要取得的公用方法名稱。The String containing the name of the public method to get.

types
Type[]

Type 物件的陣列,代表所要取得之方法的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the method to get.

-或--or- 用以取得沒有參數的方法之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

傳回

MethodInfo 物件,表示其參數符合指定之引數類型的公用方法 (如有找到);否則為 nullA MethodInfo object representing the public method whose parameters match the specified argument types, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋指定的公用方法,其參數符合指定的引數類型。The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types.

GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) method.

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

參數

name
String String String String

String,包含要取得的方法名稱。The String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

binder
Binder Binder Binder Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

callConvention
CallingConventions CallingConventions CallingConventions CallingConventions

CallingConventions 物件,其指定一組所要使用的規則,而這些規則是關於引數的順序和配置、如何傳遞傳回值、引數使用哪些暫存器以及如何清除堆疊。The CallingConventions object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and how the stack is cleaned up.

types
Type[]

Type 物件的陣列,代表所要取得之方法的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the method to get.

-或--or- 用以取得沒有參數的方法之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

MethodInfo 物件,表示符合指定之需求的方法 (如有找到);否則為 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋指定的方法,其參數符合指定引數類型和修飾詞,使用指定的繫結條件約束和指定的呼叫慣例。The Type.GetMethod method searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) method.

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

參數

name
String String String String

String,包含要取得的方法名稱。The String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

binder
Binder Binder Binder Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

types
Type[]

Type 物件的陣列,代表所要取得之方法的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the method to get.

-或--or- 用以取得沒有參數的方法之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

MethodInfo 物件,表示符合指定之需求的方法 (如有找到);否則為 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋指定的參數符合指定引數類型和修飾詞,使用指定的繫結條件約束的方法。The Type.GetMethod method searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetMethod(String) GetMethod(String) GetMethod(String) GetMethod(String)

為 COM 物件提供與版本無關的 GetMethod(String) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String) method.

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

參數

name
String String String String

String,包含要取得的公用方法名稱。The String containing the name of the public method to get.

傳回

MethodInfo 物件,表示具有指定之名稱的公用方法 (如有找到);否則為 nullA MethodInfo object representing the public method with the specified name, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋具有指定名稱的公用方法。The Type.GetMethod method searches for the public method with the specified name.

GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags)

為 COM 物件提供與版本無關的 GetMethod(String, BindingFlags) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, BindingFlags) method.

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 String String String

String,包含要取得的方法名稱。The String containing the name of the method to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-或--or- 零,傳回 nullZero, to return null.

傳回

MethodInfo 物件,表示符合指定之需求的方法 (如有找到);否則為 nullA MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋指定的方法,使用指定的繫結條件約束。The Type.GetMethod method searches for the specified method, using the specified binding constraints.

GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[])

為 COM 物件提供與版本無關的 GetMethod(String, Type[], ParameterModifier[]) 方法之存取權。Provides COM objects with version-independent access to the GetMethod(String, Type[], ParameterModifier[]) method.

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

參數

name
String String String String

String,包含要取得的公用方法名稱。The String containing the name of the public method to get.

types
Type[]

Type 物件的陣列,代表所要取得之方法的參數數目、順序和類型。An array of Type objects representing the number, order, and type of the parameters for the method to get.

-或--or- 用以取得沒有參數的方法之 Type 類型的空陣列 (也就是,Type[] types = new Type[0])。An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 types 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

傳回

MethodInfo 物件,表示符合指定之需求的公用方法 (如有找到);否則為 nullA MethodInfo object representing the public method that matches the specified requirements, if found; otherwise, null.

備註

這個方法會從 unmanaged 程式碼,是用於存取 managed 類別,並不會呼叫從 managed 程式碼。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetMethod方法會搜尋指定的公用方法,其參數符合指定引數類型和修飾詞。The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types and modifiers.

適用於