0

所以我有一个对象列表,我想获取每个对象中的每个属性并将其保存为字符串。

对象看起来像

Public Class parameters
    Public Property test As String
    Public Property test_type As String
    Public Property user_test_name As String
    Public Property meas As String
    Public Property spec_min As String
    Public Property spec_max As String
    Public Property spec_unit As String

    Public Overrides Function ToString() As String
        Return user_test_name
    End Function
End Class

这就是我到目前为止所拥有的

For Each parameters In param
    Dim myType As Type = GetType(parameters)
    Dim properties As System.Reflection.PropertyInfo() = myType.GetProperties()

    For Each p As System.Reflection.PropertyInfo In properties
        MsgBox(p.Name)
    Next
Next
4

0 回答 0