简体   繁体   中英

Visual Studio 2015 looking at arrays in the watch window

Say, I have an array of large objects I'm looking at. The object class being:

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

Normally I use the watch window and expand the objects out and check out the object property I am interested in...

So after running my code in the watch I'd have something like:

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

however, I was curious if there was a way to only see those properties of each object instead of all the other properties I'm not interested in along with it. For example, if i only wanted to see the height of each object like:

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

Is this possible with the watch window? or like the immediate window or..?

Thanks so much

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM