MemberInfo.MemberType Property
.NET Framework (current version)
When overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Reflection.MemberTypesA MemberTypes value indicating the type of member.
Implements
_MemberInfo.MemberTypeThis 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.
Imports System Imports System.Reflection Imports Microsoft.VisualBasic Class Mymemberinfo Public Shared Function Main() As Integer Console.WriteLine(ControlChars.Cr + "Reflection.MemberInfo") ' Get the Type and MemberInfo. Dim MyType As Type = Type.GetType("System.Reflection.PropertyInfo") Dim Mymemberinfoarray As MemberInfo() = MyType.GetMembers() ' Get the MemberType method and display the elements. Console.Write(ControlChars.Cr + "There are {0} members in ", _ Mymemberinfoarray.GetLength(0)) Console.Write("{0}.", MyType.FullName) Dim counter As Integer For counter = 0 To Mymemberinfoarray.Length - 1 Console.Write(ControlChars.CrLf + counter.ToString() + ". " _ + Mymemberinfoarray(counter).Name _ + " Member type - " _ + Mymemberinfoarray(counter).MemberType.ToString()) Next counter Return 0 End Function End Class
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: