MemberTypes Enumeration

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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)

[<SerializableAttribute>]
[<FlagsAttribute>]
[<ComVisibleAttribute(true)>]
type MemberTypes

Member nameDescription
All

Specifies all member types.

Constructor

Specifies that the member is a constructor

Custom

Specifies that the member is a custom member type.

Event

Specifies that the member is an event.

Field

Specifies that the member is a field.

Method

Specifies that the member is a method.

NestedType

Specifies that the member is a nested type.

Property

Specifies that the member is a property.

TypeInfo

Specifies that the member is a type.

These enumeration values are returned by the following properties:

To obtain the MemberTypes value for a type:

  1. Get a Type object that represents that type.

  2. Retrieve the value of the Type.MemberType property.

To get the MemberTypes values for the members of a type.:

  1. Get a Type object that represents that type.

  2. Retrieve the MemberInfo array that represents the members of that type by calling the Type.GetMembers method.

  3. Retrieve the value of the From the MemberInfo.MemberType property for each member in the array. A switch statement in C# or Select Case statement in Visual Basic is typically used to process member types.

MemberTypes matches CorTypeAttr as defined in the corhdr.h file.

The following example displays the names of the members of the ReflectionTypeLoadException class and their associated member types.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: