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.

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

Here, you can take help of Immediate window to declare a new object to used it further.

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

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.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Explore More

Working With File Class In C#

In C#, ‘File’ class provides many static methods for moving, copying, and deleting files. These Static methods involve moving a file and copying and deleting a file also. Let’s check

How to Read a Text File in C#

In C# ‘File’ class provides static methods to read given text file data. The File.ReadAllText() method opens a text file, reads all the text present in the file into a

C# | How to use Interface references

In C#, you’re permitted to make a reference variable of an interface type or in other words, you’re permitted to form an interface reference variable. Such kind of variable can