C# TypeInfo GetMethod(String)
Description
TypeInfo GetMethod(String)
Searches for the public
method with the specified name.
Syntax
TypeInfo.GetMethod(String)
has the following syntax.
public MethodInfo GetMethod(
string name
)
Parameters
TypeInfo.GetMethod(String)
has the following parameters.
name
- The string containing the name of the public method to get.
Returns
TypeInfo.GetMethod(String)
method returns An object that represents the public method with the specified name, if found;
otherwise, null.
Example
using System;// w w w. ja va 2 s . c o m
using System.Reflection;
class Program
{
public void MethodA() { }
static void Main(string[] args)
{
MethodInfo mInfo = typeof(Program).GetMethod("MethodA");
Console.WriteLine("Found method: {0}", mInfo);
}
}
The code above generates the following result.