Get Method name in CSharp
Description
The following code shows how to get Method name.
Example
// ww w.j a va2 s. c o m
using System;
using System.Reflection;
class Mymemberinfo
{
public static int Main()
{
Type MyType = Type.GetType("System.Empty");
MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
Console.Write(Mymemberinfoarray.GetLength(0));
Console.Write(MyType.FullName);
foreach (MemberInfo Mymemberinfo in Mymemberinfoarray)
{
Console.Write("\n" + Mymemberinfo.Name + " declaring type - " + Mymemberinfo.DeclaringType);
}
return 0;
}
}
The code above generates the following result.