GetMethod Method (String, Type[])

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Searches for the specified public method whose parameters match the specified argument types.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function GetMethod ( _
    name As String, _
    types As Type() _
) As MethodInfo
public MethodInfo GetMethod(
    string name,
    Type[] types
)
public:
MethodInfo^ GetMethod(
    String^ name, 
    array<Type^>^ types
)
member GetMethod : 
        name:string * 
        types:Type[] -> MethodInfo 
public function GetMethod(
    name : String, 
    types : Type[]
) : MethodInfo

Parameters

  • types
    Type: array<System. . :: . .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 Type objects (as provided by the EmptyTypes field) to get a method that takes no parameters.

Return Value

Type: System.Reflection. . :: . .MethodInfo
An object representing the public method whose parameters match the specified argument types, if found; otherwise, nullNothingnullptrunita null reference (Nothing in Visual Basic).

Remarks

The search for name is case-sensitive. The search includes public static and public instance methods.

If the current T:System.Type represents a constructed generic type, this method returns the 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.

.NET Framework Security

See Also

Reference

Type Class

GetMethod Overload

System Namespace