PropertyInfo.MemberType Property
Gets a MemberTypes value indicating that this member is a property.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Reflection.MemberTypesA MemberTypes value indicating that this member is a property.
Implements
_PropertyInfo.MemberType_MemberInfo.MemberType
This property overrides MemberType. Therefore, when you examine a set of MemberInfo objects — for example, the array returned by GetMembers — the MemberType property returns Property only when a given member is a property.
MemberType is a derived class of MemberInfo and specifies the type of member this is. Member types are constructors, properties, fields, and methods. Since this is a PropertyInfo property, the returned type is a property.
To get the MemberType property, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, get the MemberType value.
The following example displays the type of the specified member.
using System; using System.Reflection; class Mypropertyinfo { public static int Main() { Console.WriteLine("\nReflection.PropertyInfo"); // Get the type and PropertyInfo. Type MyType = Type.GetType("System.Reflection.MemberInfo"); PropertyInfo Mypropertyinfo = MyType.GetProperty("Name"); // Read and display the MemberType property. Console.Write("\nMemberType = " + Mypropertyinfo.MemberType.ToString()); return 0; } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.