The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MemberTypes Enumeration

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Marks each type of member that is defined as a derived class of MemberInfo.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public enum MemberTypes

Member nameDescription
AllSpecifies all member types.
ConstructorSpecifies that the member is a constructor, representing a ConstructorInfo member. Hexadecimal value of 0x01.
CustomSpecifies that the member is a custom member type. Hexadecimal value of 0x40.
EventSpecifies that the member is an event, representing an EventInfo member. Hexadecimal value of 0x02.
FieldSpecifies that the member is a field, representing a FieldInfo member. Hexadecimal value of 0x04.
MethodSpecifies that the member is a method, representing a MethodInfo member. Hexadecimal value of 0x08.
NestedTypeSpecifies that the member is a nested type, extending MemberInfo.
PropertySpecifies that the member is a property, representing a PropertyInfo member. Hexadecimal value of 0x10.
TypeInfoSpecifies that the member is a type, representing a TypeInfo member. Hexadecimal value of 0x20.

These enum values are returned by MemberType and are useful in switch statements. MemberTypes matches CorTypeAttr as defined in the corhdr.h file.

To obtain the MemberTypes value for a method:

  • First get a Type.

  • From the Type, get the MemberInfo array.

  • From the MemberInfo array, get the MemberType.

The following example displays the member types for the specified class.

using System;
using System.Reflection;

class Example
   public static int Demo(System.Windows.Controls.TextBlock outputBlock)
      outputBlock.Text += "\nReflection.MemberTypes" + "\n";
      MemberTypes Mymembertypes;

      // Get the type of a chosen class.
      Type Mytype = Type.GetType

      // Get the MemberInfo array.
      MemberInfo[] Mymembersinfoarray = Mytype.GetMembers();

      // Get and display the name and the MemberType for each member.
      foreach (MemberInfo Mymemberinfo in Mymembersinfoarray)
         Mymembertypes = Mymemberinfo.MemberType;
         outputBlock.Text += String.Format("The member {0} of {1} is a {2}.", Mymemberinfo.Name, Mytype, Mymembertypes.ToString()) + "\n";
      return 0;

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone