本文整理汇总了VB.NET中System.Reflection.FieldInfo类的典型用法代码示例。如果您正苦于以下问题:VB.NET FieldInfo类的具体用法?VB.NET FieldInfo怎么用?VB.NET FieldInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FieldInfo类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: FieldInfoClass
' 导入命名空间
Imports System.Reflection
Public Class FieldInfoClass
Public myField1 As Integer = 0
Protected myField2 As String = Nothing
Public Shared Sub Main()
Dim myFieldInfo() As FieldInfo
Dim myType As Type = GetType(FieldInfoClass)
' Get the type and fields of FieldInfoClass.
myFieldInfo = myType.GetFields(BindingFlags.NonPublic Or _
BindingFlags.Instance Or BindingFlags.Public)
Console.WriteLine(ControlChars.NewLine & "The fields of " & _
"FieldInfoClass class are " & ControlChars.NewLine)
' Display the field information of FieldInfoClass.
Dim i As Integer
For i = 0 To myFieldInfo.Length - 1
Console.WriteLine(ControlChars.NewLine + "Name : {0}", myFieldInfo(i).Name)
Console.WriteLine("Declaring Type : {0}", myFieldInfo(i).DeclaringType)
Console.WriteLine("IsPublic : {0}", myFieldInfo(i).IsPublic)
Console.WriteLine("MemberType : {0}", myFieldInfo(i).MemberType)
Console.WriteLine("FieldType : {0}", myFieldInfo(i).FieldType)
Console.WriteLine("IsFamily : {0}", myFieldInfo(i).IsFamily)
Next i
End Sub
End Class