Gets the name of the current member.
using System;
using System.Reflection;
class Mymemberinfo
{
public static int Main()
{
Type MyType = Type.GetType("System.Empty");
MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
Console.Write("\nThere are {0} members in ",Mymemberinfoarray.GetLength(0));
Console.Write("{0}.", MyType.FullName);
foreach (MemberInfo Mymemberinfo in Mymemberinfoarray)
{
Console.Write("\n" + Mymemberinfo.Name+ " declaring type - " +Mymemberinfo.DeclaringType);
}
return 0;
}
}
Related examples in the same category