Zeigen Sie alle Klassenmitglieder mit einem für Loop VB.NET an

Public Class [MyClass]
    Private a As String
    Private b As String

    Public Sub New(a As String, b As String)
        Me.a = a
        Me.b = b
    End Sub

    Public Overrides Function ToString() As String
        Dim sb = New StringBuilder()
        For Each item In [GetType]().GetFields(BindingFlags.NonPublic Or BindingFlags.Instance)
             sb.Append(item.Name) _
               .Append("=") _
               .Append(item.GetValue(Me)) _
               .Append(" ")
        Next
        Return sb.ToString()
    End Function
Cooperative Copperhead