Get a MemberTypes value indicating the type of the member(method, constructor, event, and so on.)
using System;
using System.Reflection;
class Mymemberinfo
{
public static int Main()
{
Type MyType = Type.GetType("System.Reflection.PropertyInfo");
MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
Console.Write("\nThere are {0} members in ", Mymemberinfoarray.GetLength(0));
Console.Write("{0}.", MyType.FullName);
for (int counter = 0; counter < Mymemberinfoarray.Length; counter++)
{
Console.Write("\n" + counter + ". "
+ Mymemberinfoarray[counter].Name
+ " Member type - " +
Mymemberinfoarray[counter].MemberType.ToString());
}
return 0;
}
}
Related examples in the same category