Επεξεργασία

Κοινή χρήση μέσω


_Type.GetMethod Method

Definition

Provides COM objects with version-independent access to the GetMethod method.

Overloads

GetMethod(String, Type[])

Provides COM objects with version-independent access to the GetMethod(String, Type[]) method.

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[])

Provides COM objects with version-independent access to the GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) method.

GetMethod(String)

Provides COM objects with version-independent access to the GetMethod(String) method.

GetMethod(String, BindingFlags)

Provides COM objects with version-independent access to the GetMethod(String, BindingFlags) method.

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

Provides COM objects with version-independent access to the GetMethod(String, Type[], ParameterModifier[]) method.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method.

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

Parameters

name
String

The String containing the name of the public method to get.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the method to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

Returns

A MethodInfo object representing the public method whose parameters match the specified argument types, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types.

Applies to

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
Public Function GetMethod (name As String, bindingAttr As BindingFlags, binder As Binder, callConvention As CallingConventions, types As Type(), modifiers As ParameterModifier()) As MethodInfo

Parameters

name
String

The String containing the name of the method to get.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

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, to use the DefaultBinder.

callConvention
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[]

An array of Type objects representing the number, order, and type of the parameters for the method to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

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.

Returns

A MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

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.

Applies to

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
Public Function GetMethod (name As String, bindingAttr As BindingFlags, binder As Binder, types As Type(), modifiers As ParameterModifier()) As MethodInfo

Parameters

name
String

The String containing the name of the method to get.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

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, to use the DefaultBinder.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the method to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

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.

Returns

A MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

Applies to

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

Parameters

name
String

The String containing the name of the public method to get.

Returns

A MethodInfo object representing the public method with the specified name, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method searches for the public method with the specified name.

Applies to

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

Parameters

name
String

The String containing the name of the method to get.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

Returns

A MethodInfo object representing the method that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method searches for the specified method, using the specified binding constraints.

Applies to

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

Parameters

name
String

The String containing the name of the public method to get.

types
Type[]

An array of Type objects representing the number, order, and type of the parameters for the method to get.

-or-

An empty array of the type Type (that is, Type[] types = new Type[0]) to get a method that takes no parameters.

modifiers
ParameterModifier[]

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.

Returns

A MethodInfo object representing the public method that matches the specified requirements, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetMethod method searches for the specified public method whose parameters match the specified argument types and modifiers.

Applies to