Retrieves a the type of this member.
[Visual Basic] MustOverride Public ReadOnly Property MemberType As MemberTypes [C#] public MemberTypes MemberType {abstract get;} [C++] public: __property virtual MemberTypes get_MemberType() = 0; [JScript] public abstract function get MemberType() : MemberTypes;
Read-only.
An enumerated value from the MemberTypes class describing this member as a constructor, event, field, method, property, type information, all, or custom.
The MemberTypes property retrieves a MemberTypes object that describes this member as constructor, event, field, method, property, type information, all, or custom.
The returned value is from the MemberTypes enumeration, an enumerated value from the MemberTypes class describing this member as a constructor, event, field, method, property, type information, all, or custom.
To get the MemberType property:
[C#]
class Mymemberinfo { public static int Main() { Console.WriteLine ("\nReflection.MemberInfo"); //Get the Type and MemberInfo Type MyType = Type.GetType("System.Reflection.PropertyInfo"); MemberInfo[] Mymemberinfoarray = MyType.GetMembers(); //Get MemberType method- display the 38th- 41th elements only Console.Write("\nThere are {0} members in " Mymemberinfoarray.Count); Console.Write("{0}.", MyType.FullName); for ( int counter = 37; counter <40; counter++) { Console.Write("\n" + counter + ". " + Mymemberinfoarray[counter].Name + " Member type - " + EnumInfo.ToString(typeof(MemberTypes), Mymemberinfoarray[counter].MemberType)); } return 0; } } Produces the following output Reflection.MemberInfo There are 52 members in System.Reflection.PropertyInfo. 37. GetCanRead Member type - Method 38. GetCanWrite Member type - Method 39. MemberType Member type - Property 40. PropertyType Member type - Property [To be supplied]
MemberInfo Class | MemberInfo Members | System.Reflection Namespace