Name Property
Collapse the table of content
Expand the table of content

MemberInfo.Name Property

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

Gets the name of the current member.

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

'Declaration
Public MustOverride ReadOnly Property Name As String

Property Value

Type: System.String
The name of this member.

Only the simple name of the member is returned, not the fully qualified name.

To get the Name property, get the class Type. From the Type, get the MemberInfo array. From a MemberInfo element of the array, obtain the Name property.

This example lists the Name and DeclaringType property of each member of the specified class.


Imports System.Reflection

Class Example
   Public Shared Function Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) As Integer
      outputBlock.Text &= "Reflection.MemberInfo" & vbCrLf

      ' Get the Type and MemberInfo.
      Dim MyType As Type = Type.GetType("System.Empty")
      Dim Examplearray As MemberInfo() = MyType.GetMembers()

      ' Get and display the DeclaringType method.
      outputBlock.Text += String.Format("There are {0} members in {1}", Examplearray.GetLength(0), MyType.FullName) & vbCrLf

      Dim Example As MemberInfo
      For Each Example In Examplearray
         outputBlock.Text &= Example.Name & " declaring type - " & Example.DeclaringType.ToString() & vbCrLf
      Next Example

      Return 0
   End Function
End Class


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft