MemberInfo::MemberType Property
When overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Reflection::MemberTypesA MemberTypes value indicating the type of member.
Implements
_MemberInfo::MemberTypeThis property is overridden in derived classes, and the override returns the appropriate member type. Therefore, when you examine a set of MemberInfo objects — for example, the array returned by GetMembers — the MemberType property can be used to determine the member type of any given member.
To get the MemberType property, get the class Type. From the Type, get the MethodInfo array. From the MethodInfo array, get the MemberTypes.
The following example displays the member name and type of a specified class.
using namespace System; using namespace System::Reflection; int main() { Console::WriteLine( "\nReflection.MemberInfo" ); // Get the Type and MemberInfo. Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" ); array<MemberInfo^>^Mymemberinfoarray = MyType->GetMembers(); // Get the MemberType method and display the elements. 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{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType ); } return 0; }
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0