当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET FieldInfo类代码示例

本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System.Reflection,代码行数:27,代码来源:FieldInfo


注:本文中的System.Reflection.FieldInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。