我正在我的项目中调试一个复杂的计算对象,我想在文本框中显示它的各种属性,以使我的测试更容易.
我能做点什么吗
for each p as someKindOfProperty in MyObject1
debug.print(p.name & " - " & debug.print p.value)
textbox1.text = textbox1.text & vbcrlf & p.name & " - " & p.value
next
Run Code Online (Sandbox Code Playgroud)
???
怎么样?
Dim props As PropertyInfo() = GetType(Color).GetProperties(BindingFlags.[Static] Or BindingFlags.[Public])
For Each prop As PropertyInfo In props
Dim o As Object = prop.GetValue(Nothing, Nothing)
If o IsNot Nothing Then
textbox1.Text = Textbox1.text + Constants.vbcrlf + prop.Name + " - " + o.ToString()
End If
Next
Run Code Online (Sandbox Code Playgroud)