Most people know that when you are debugging, you can hover the mouse over a variable in your code and the tool tip will provide you the current value.
For example, if I hover over the “uri” variable below it shows me that it’s current content is “http://azure.microsoft.com/”
That is very helpful, but what if I am going in and out of this code very often. Say I’m calling the function multiple times and I want to see this value each time. I want to quickly glance at the value instead of having to hover and wait.
I could use the Watch Window and add the uri variable to that. Then it would always show me the value but its not as convenient as it could be.
Look at the right end of the data tip. That is a pin! Click that.
Now the value is pinned in place right where I can see it – no hunting for it. It is pinned to line 30 and will stay there while I’m in debug mode (even if I stop and restart debugging). It will update in real time and, because it is right in the code, I have the context to know exactly what it is for.
In addition, if I hover over the pinned data tip, I can add a comment to help me remember why I pinned it there.
For more on Data Tips, see the documentation
This post is part of a series of Visual Studio tips. The first post in the series contains the whole list.
(next tip – Use “Navigate To”)