Blog Stats
  • Posts - 47
  • Articles - 0
  • Comments - 21
  • Trackbacks - 0

 

Sunday, May 2, 2010

Tips on debugging collections


 

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 !

 

 

Copyright © Vincent Grondin