MemberType Property

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.

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

public abstract MemberTypes MemberType { get; }

Property Value

Type: System.Reflection.MemberTypes

A MemberTypes value indicating the type of member.

This 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 System;
using System.Reflection;

class Mymemberinfo
    public static int Main()
        Console.WriteLine ("\nReflection.MemberInfo");

        // Get the Type and MemberInfo.
        Type MyType = Type.GetType("System.Reflection.PropertyInfo");
        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" + counter + ". " 
                + Mymemberinfoarray[counter].Name
                + " Member type - " +
        return 0;

.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft