Maury Markowitz
Maury Markowitz

Reputation: 9273

Debugging collections of compound objects

Let's say I have...

Class Thingy
   Friend One As String   
   Friend Two As String
   Friend Three As String
End Class

Dim stuff As (List of Thingy)

Ok, something is going wrong when working with stuff collections. As some point the value of Three goes wrong in some of the objects. How do I watch this? If I watch the collection I have to open up all the objects, and that can be very long. Or I could write a ToString for Thingy to print out the Three, but I wouldn't want to have to constantly change it.

So is there a way to use the .net debugger to watch a particular field across a collection?

Upvotes: 0

Views: 15

Answers (2)

SSS
SSS

Reputation: 5393

Override ToString in your object, then when you hover your mouse over the collection, and click the pop-out arrow thingy, you can see each value:

Public Overrides Function ToString() As String
  Return One & ":" & Two & ":" & Three
End Function

enter image description here

Upvotes: 0

Thomas Weller
Thomas Weller

Reputation: 59238

OzCode's feature Reveal provides what you want. However, it's a commercial plugin for Visual Studio.

Just click the star icon of a property and it will display that property of all items in the collection.

Upvotes: 1

Related Questions