Introduction
VS 2010 and C# 4.0 introduced so many new features. Here in this article, I try to cover some very simple, yet very useful features of both.
1. Hiding the Selected Part of Code
Many a times, a situation arises when we want to hide a specified piece of code rather that hiding the entire region. This has become easier in VS 2010. Just select the part of the code that you want to hide and right click select Outlining -> Hide Selection.
Same way like a region code also gets collapsible and expandable area. Anytime you wish to remove this hiding of text again, select right click, select Outlining -> Stop Hiding Current.
2. DataTips
This option provides us with a simpler way by which we can communicate with any variable at debugging time. In 2010, a DataTip can be pinned at a location or it can even float. This gives us an easier way to monitor our variable and its value during debugging. We can add as many DataTips and will remain there even after the session is closed.
In order to add Pin to DataTip, just place the mouse pointer over any variable you can see the pin icon click on it.
You can move your pin to any location. Pin provides you three buttons close, Unpin (to remove pin), Expand (to add any comment).
Once code has been debugged and still we want to see what value the variable/expression was holding at the time of debugging, then this feature is very helpful.
You can even Export/Import your DataTips. Click on Debug ->Export DataTips -> Specify the location where you want the XML file to be saved.
You can access your XML file anytime by selecting Import option on the Debug -> Import DataTips.