' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
﻿Imports System
Imports System.Reflection

Namespace E
    Public Class X
        Private v1 As Integer
        Protected v2 As Integer
        Friend v3 As Integer
        Public v4 As Integer
        Private Shared v5 As Integer
        Protected Shared v6 As Integer
        Friend Shared v7 As Integer
        Public Shared v8 As Integer
    End Class
    Public Class Program
        Public Shared Sub Dump(label As String, typ As Type)
            Console.WriteLine(label & ":")
            For Each fi As FieldInfo In typ.GetFields()
                Console.WriteLine("  " & fi.Name)
            Next
        End Sub
        Public Shared Sub Dump(label As String, typ As Type, flags As BindingFlags)
            Console.WriteLine(label & ":")
            For Each fi As FieldInfo In typ.GetFields(flags)
                Console.WriteLine("  " & fi.Name)
            Next
        End Sub
        Public Shared Sub Main(args As String())
            Dump("Default", GetType(X))
            Dump("Public instance", GetType(X), BindingFlags.Public Or BindingFlags.Instance)
            Dump("NonPublic instance", GetType(X), BindingFlags.NonPublic Or BindingFlags.Instance)
            Dump("Public static", GetType(X), BindingFlags.Public Or BindingFlags.Static)
            Dump("NonPublic static", GetType(X), BindingFlags.NonPublic Or BindingFlags.Static)
            Dump("Everything", GetType(X), BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.Static)
        End Sub
    End Class
End Namespace
