Module.GetMethod Method

Definition

Returns a method having the specified criteria.

Overloads

GetMethod(String)

Returns a method having the specified name.

GetMethod(String, Type[])

Returns a method having the specified name and parameter types.

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

Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.

GetMethod(String)

Returns a method having the specified name.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name);
public System.Reflection.MethodInfo? GetMethod (string name);
public System.Reflection.MethodInfo GetMethod (string name);
member this.GetMethod : string -> System.Reflection.MethodInfo
Public Function GetMethod (name As String) As MethodInfo

Parameters

name
String

The method name.

Returns

MethodInfo

A MethodInfo object having the specified name, or null if the method does not exist.

Exceptions

name is null.

GetMethod(String, Type[])

Returns a method having the specified name and parameter types.

public:
 System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types);
public System.Reflection.MethodInfo? GetMethod (string name, 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

Parameters

name
String

The method name.

types
Type[]

The parameter types to search for.

Returns

MethodInfo

A MethodInfo object in accordance with the specified criteria, or null if the method does not exist.

Exceptions

name is null, types is null, or types (i) is null.

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

Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.

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);
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

Parameters

name
String

The method name.

bindingAttr
BindingFlags

One of the BindingFlags bit flags used to control the search.

binder
Binder

An object that implements Binder, containing properties related to this method.

callConvention
CallingConventions

The calling convention for the method.

types
Type[]

The parameter types to search for.

modifiers
ParameterModifier[]

An array of parameter modifiers used to make binding work with parameter signatures in which the types have been modified.

Returns

MethodInfo

A MethodInfo object in accordance with the specified criteria, or null if the method does not exist.

Exceptions

name is null, types is null, or types (i) is null.

See also

Applies to