- name
- The string containing the name of the public method to get.
- types
- An array of Type objects representing the number, order, and type of the parameters for the method to get.
An object representing the public method whose parameters match the specified argument types, if found; otherwise, null.
Type Reason System.Reflection.AmbiguousMatchException More than one method matching the specified criteria was found. ArgumentNullException name or types is null.
-or-
At least one of the elements in types is null.
ArgumentException types has more than one dimension.
The search for name is case-sensitive. The search includes public static and public instance methods.
You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.
If the current T:System.Type represents a constructed generic type, this method returns the System.Reflection.MethodInfo with the type parameters replaced by the appropriate type arguments.
If the current Type represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of object if there is no class constraint.
The name parameter cannot include type arguments. For example, the C# code GetMethod("MyGenericMethod<int>") searches for a method with the text name "MyGenericMethod<int>", rather than for a method named MyGenericMethod that has one generic argument of type int. Instead, use GetMethod("MyGenericMethod") with the appropriate parameter in the types array.