TypeGetMethod Method (String, BindingFlags, Binder, CallingConventions, Type, ParameterModifier) |
Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public MethodInfo GetMethod(
string name,
BindingFlags bindingAttr,
Binder binder,
CallingConventions callConvention,
Type[] types,
ParameterModifier[] modifiers
)
Parameters
- name
- Type: SystemString
The string containing the name of the method to get. - bindingAttr
- Type: System.ReflectionBindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted.-or- Zero, to return null. - binder
- Type: System.ReflectionBinder
An 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- A null reference (Nothing in Visual Basic), to use the DefaultBinder. - callConvention
- Type: System.ReflectionCallingConventions
The 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: SystemType
An array of Type objects representing the number, order, and type of the parameters for the method to get.-or- An empty array of Type objects (as provided by the EmptyTypes field) to get a method that takes no parameters. - modifiers
- Type: System.ReflectionParameterModifier
An array of ParameterModifier objects representing the attributes associated with the corresponding element in the types array. To be only used when calling through COM interop, and only parameters that are passed by reference are handled. The default binder does not process this parameter.
Return Value
Type:
MethodInfoAn object representing the method that matches the specified requirements, if found; otherwise, null.
Exceptions Exception | Condition |
---|
AmbiguousMatchException | More than one method is found with the specified name and matching the specified binding constraints. |
ArgumentNullException | name is null.-or- types is null.-or- One of the elements in types is null. |
ArgumentException | types is multidimensional.-or- modifiers is multidimensional. |
See Also