天天看点

VB.net 结构体的遍历

Structure TEmployee

        Dim idno As String

        Dim name As String

        Dim age As Integer

        Dim memo As String
    End Structure
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 
        Dim a As TEmployee
        a.idno = "001"
        a.name = "sss"
        a.age = "11"
        a.memo = "memooo"
        MessageBox.Show(a.GetType.GetFields.Count)
        For Each abc In a.GetType.GetFields
            MessageBox.Show(abc.GetValue(a))
        Next
   
    End Sub