Mono Class Library: System.Type Overview | Members

System.Type.GetMethod Method

Returns a System.Reflection.MethodInfo object that reflects the public method defined in the type represented by the current instance that has the specified name and parameter information. [Edit]

public System.Reflection.MethodInfo GetMethod (string name, Type[] types)

Parameters

name
A string containing the name of the public method to be returned. [Edit]
types
An array of Type objects. The elements in the array are of the same number, in the same order, and represent the same types as the parameters for the method to be returned. [Edit]

Returns

A System.Reflection.MethodInfo object reflecting the public method defined in the type represented by the current instance that matches the specified criteria. If no public method matching the specified criteria is found, returns null . [Edit]

Exceptions

TypeReason
System.Reflection.AmbiguousMatchExceptionMore than one method matching the specified criteria was found. [Edit]
ArgumentNullException

name or types is null.

-or-

At least one of the elements in types is null.

[Edit]
ArgumentExceptiontypes has more than one dimension. [Edit]

Remarks

The search for name is case-sensitive.

This version of Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, Type[], System.Reflection.ParameterModifier[]) is equivalent to Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, Type[], System.Reflection.ParameterModifier[])(name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Instance, null, types, null).

If the current instance represents a generic type, this method returns the System.Reflection.MethodInfo with the type parameters replaced by the appropriate type arguments.

If the current instance represents an unassigned type parameter of a generic type or method, this method searches the methods of the class constraint, or the methods of object if there is no class constraint; the methods of all interface constraints; and the methods of any interfaces inherited from class or interface constraints.

Note: The name parameter cannot include type arguments.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0