How to use Runtime Objects in Watch Window during debugging in Visual Studio ?

By | January 20, 2011

During debugging in visual studio we generally used watch window to explore the objects, values, properties and other nested objects as a tree structure. Most of the time we used watch window to only view the values or change the current object properties values to see the effects of changed object during debugging. And most of the time we debug with the context of current object, object values etc but what if, If you need a brand new object instead of object value. This scenarios will come when you want to compare some existing value with some new object values. You can instantiate a new object by just type new ClassName(), which will generate you the new instance of your class as shown in below picture.

newobj1

But, you need to take help of Immediate window if you want to declare a new object to used it further

newobj2

As shown in above image you can create new object and used it immediate window.

Why do we need to take help of Immediate window to declare the object ? because Immediate window does not allow you declaration statements.

newobj3

2 thoughts on “How to use Runtime Objects in Watch Window during debugging in Visual Studio ?

  1. Pingback: SHRAVAN Weblog » 14 Useful .NET Debugging Tips & Tricks in Visual Studio

  2. Pingback: 10 Effective Debugging Tips for .NET Developer

Comments are closed.