DataTips is an advanced tooltip message that can be used for inspecting the objects or variables while debugging the application with in Visual Studio. This feature was there for past several version of Visual Studio. DataTips can be pined, can float over the editor, you can write comments on each tip, or even you can import and export them. In addition to those feature, you can also inspect the last session debugging value using the data tips.
In this post I am going to talk about another coolest feature ( I would rather say, coolest hidden feature) of the data tips which is known as “Add Expression” . Add Expression, can allow you to add a new expression within the DataTips. Let’s have a look how this can be used.
First of all, in the debugging session, add a DataTip as shown in the image below.
Fig: Adding DataTips
Once the first data tip is added, “Right Click” on that, and select “Add Expression” from the context menu.
Fig: Adding a New Expression Within the DataTips
With that, a placeholder of expression will be placed within the same DataTips window.
Fig: Placeholder for new expression
Then you can add a new expression with in the placeholder. The Visual Studio data tip will automatically evaluate the value and display over there. In the below image, you can see we have added a variable “i” and corresponding values being displayed on the DataTips.
Fig: New Expression Added
You can also set or validate some conditional statement as shown in below image.
Fig: Adding Multiple Expression
If there is something, which is not required and has been added in the expression list, you an simply remove them by selecting “Remove Expression” from the context menu.
Fig: Removing Expression
Hope you liked it !
Feel free to share your comments !