0

比如说,我正在查看一系列大型对象。对象类是:

Class Box
  Public length As Double
  Public breadth As Double
  Public height As Double
  ...
  ...
  Public blah as blah
End Class

通常我使用监视窗口并展开对象并检查我感兴趣的对象属性......

所以在手表上运行我的代码后,我会得到类似的东西:

- box[0]
    length      12      double
    breadth     10      double
    height      5       double
    ...
    ...
    blah        x       blah
+ box[1]
+ box[2]
.
.
.
+ box[x]

但是,我很好奇是否有一种方法可以只查看每个对象的这些属性,而不是查看我不感兴趣的所有其他属性。例如,如果我只想查看每个对象的高度,例如:

- box[0]
    height      5       double
- box[1]
    height      3       double
- box[2]
   height      2       double
.
.
.
- box[x]        x       double

监视窗口可以做到这一点吗?或喜欢直接窗口或..?

非常感谢

4

1 回答 1

1

Not sure if it counts a duplicate, per se, but one option might as answered in Can the watch window value of a List<> be customised?

Alternatively, you can customize how the Watch window displays different objects. See: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-visualizers-of-data?view=vs-2017

(edit: previous version pointed to the NatVis, which is just for Native objects)

于 2018-11-30T22:25:26.290 回答