Adding New Expression in Visual Studio DataTips

Adding New Expression in Visual Studio DataTips

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.

DataTip Default

Fig: Adding DataTips

Once the first data tip is added, “Right Click” on that, and select “Add Expression” from the context menu.

DataTip Add Expression

Fig: Adding a New Expression Within the  DataTips

With that, a placeholder of expression will be placed within the same DataTips window.

DataTip Add Expression Placeholder 

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.

DataTip Added Expression 

Fig: New Expression Added

You can also set or validate some conditional statement as shown in below image.

DataTip Added Multiple Expression 

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.

Remove Expression

Fig: Removing Expression

Hope you liked it !

Feel free to share your comments !

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.