System.Reflection.MemberTypes Enumeration

Assembly: Mscorlib.dll
Namespace: System.Reflection
Summary
Marks each type of member that is defined as a derived class of MemberInfo.
C# Syntax:
[Serializable]
public enum MemberTypes
Remarks
These enum values are returned by Type.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:

Example
 using System;
 using System.Reflection;
 
 class membertypesenum {
 
    public static int Main(string[] args) {
 
        Console.WriteLine ("\nReflection.MemberTypes");
        
        MemberTypes Mymembertypes;
 
        //Get the type 
        Type Mytype = Type.GetType
        ("System.Reflection.ReflectionTypeLoadException");
 
        //Get the MemberInfo array 
        MemberInfo[] Mymembersinfoarray = Mytype.GetMembers();
 
        //Get and display the name and the MemberType for each member
 
        foreach (MemberInfo Mymemberinfo in Mymembersinfoarray) { 
            Console.Write ("\n" + Mymemberinfo.Name);
            Mymembertypes = Mymemberinfo.MemberType; 
            Console.Write (" is a " + Mymembertypes.ToString()); 
        }
 
        return 0;
 
    }
 
 }

    
This code produces the following output:

Reflection.MemberTypes

GetType is a Method

ToString is a Method

.ctor is a Constructor

Types is a Property

LoaderExceptions is a Property

See also:
System.Reflection Namespace

System.Reflection.MemberTypes Member List:

Public Fields
All
Constructor Specifies that the member is a constructor, representing a ConstructorInfo member. Hexadecimal value of 0x01.
Custom Specifies that the member is a custom member type. Hexadecimal value of 0x40.
Event Specifies that the member is an event, representing an EventInfo member. Hexadecimal value of 0x02.
Field Specifies that the member is a field, representing a FieldInfo member. Hexadecimal value of 0x04.
Method Specifies that the member is a method, representing a MethodInfo member. Hexadecimal value of 0x08.
NestedType Specifies that the member is a nested type, extending MemberInfo.
Property Specifies that the member is a property, representing a PropertyInfo member. Hexadecimal value of 0x10.
TypeInfo Specifies that the member is a type, representing a MemberTypes.TypeInfo member. Hexadecimal value of 0x20.

Hierarchy:


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.