When debugging in Visual Studio, we often use the watch window to explore objects, values, properties, and other nested objects in a tree view. Mostly, we use the watch window to just view the values or change the current value of an object property to see the impact of a changed object during debugging. And most of the time we debug with current object context, object values etc. but what if you need a whole new object instead of ‘an object value? These situations arise when you want to compare an existing value with new object values. You can instantiate a new object by simply typing new ClassName(), which will create you a new instance of the class as shown in the image below.
![newobj1 How to use Runtime Objects in Watch Window during debugging in Visual Studio ?](https://i0.wp.com/codeconfig.in/wp-content/uploads/2023/10/01_How_to_use_Runtime_Objects_in_Watch_Window_during_debugging_in_Visual_Studio__.png?resize=481%2C330&ssl=1)
Here, you can take help of Immediate window to declare a new object to used it further.
![newobj2 How to use Runtime Objects in Watch Window during debugging in Visual Studio ?](https://i0.wp.com/codeconfig.in/wp-content/uploads/2023/10/21_How_to_use_Runtime_Objects_in_Watch_Window_during_debugging_in_Visual_Studio__.png?resize=524%2C305&ssl=1)
As shown in above image you can create new object and used it in immediate window.
Must read:
Why do we need to use Immediate window helper to declare objects? Because the Immediate window does not allow you to declare.
![newobj3 How to use Runtime Objects in Watch Window during debugging in Visual Studio ?](https://i0.wp.com/codeconfig.in/wp-content/uploads/2023/10/41_How_to_use_Runtime_Objects_in_Watch_Window_during_debugging_in_Visual_Studio__.png?resize=525%2C64&ssl=1)
I hope above will help. You can check more articles on our website under C# section HERE or you can also check same on Microsoft Docs too.