Tips on debugging collections

Posted by Vincent Grondin on Geeks with Blogs See other posts from Geeks with Blogs or by Vincent Grondin
Published on Sun, 02 May 2010 18:53:17 GMT Indexed on 2010/05/03 1:08 UTC
Read the original article Hit count: 547

Filed under:

 

The "Quick Watch" feature of Visual Studio is an awesome tool when debugging your stuff...  I use it all the time and quite often I end up exploring hashtables or lists of all sorts...  One thing I hate is when I have to explore Collections...  Good god did I lose time trying to find the inner member that contains my stuff when exploring collections...  Most collections have the inside member that you can search for and find and explore to see the list of things you wanted to look at.  Something in the likes of this

 

I've known a little trick for a while now and I give it to everyone I end up debugging something with so I figured that probably not many people know about this...  Here's the tip...  Send the collection into an ArrayList in the QuickWatch window!  Yes, you heard me right, just type   

new ArrayList(yourcollectionhere)

in my case:    new ArrayList(this.Controls)

in the expresion textbox and here's the result when you hit reevaluate!

Pretty neat trick to make your debugging experience less of a pain when dealing with collections... 

 

Happy debugging all !

© Geeks with Blogs or respective owner