FieldInfo.MemberType
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public Class Myfield
Private m_field As String = "a private field"
Public ReadOnly Property Field() As String
Get
Return m_field
End Get
End Property
End Class
Public Class Myfieldinfo
Public Shared Sub Main()
Dim Myfield As New Myfield()
Dim MyType As Type = GetType(Myfield)
Dim Myfieldinfo As FieldInfo = MyType.GetField("m_field", BindingFlags.NonPublic Or BindingFlags.Instance)
Console.Write(MyType.FullName)
Console.Write("{0} - ", Myfieldinfo.Name)
Console.Write("{0};", Myfield.Field)
Dim Mymembertypes As MemberTypes = Myfieldinfo.MemberType
Console.Write("MemberType is a {0}.", Mymembertypes.ToString())
End Sub
End Class
Related examples in the same category