20 Mar
One of the great features of Visual Studio is its debugging interface. The ability to watch variables change through the code and inspect them on the fly is invaluable. The on-hover inspection and quickwatch dialogs are great if you’re dealing with lots of variables or long lists that need analysing. Being able to view the value of a whole list of objects at once is great. But this only works for simple data type objects (string, int, float, etc.). More complex objects just show the fully qualified type name. This can become really frustrating if you’ve got a long list of objects and you’re trying to find a specific one.
The reason for this difference is that when it’s displaying your variables, the watch dialog does an implicit ToString() call to display the ‘value’ column. If ToString() hasn’t been implemented, it calls the ToString() method of the base object type, which as mentioned, just returns the fully qualified type. However if you do implement ToString(), it can be a God-send when you’re debugging.
Here’s a trivial example: