Wednesday, April 13, 2011

Variable Reference Code Highlighting and Hide selection features of Visual Studio 2010.

Microsoft Visual studio 2010 is a Great IDE(Integrated Development Environment) and I am exploring everyday something new in this blog post , I am also going to explore something new with Visual Studio 2010. There are two more new features that can make developers life easier. Let’s explore that in detail.

Variable Reference Code Highlighting

It’s a new feature there in Visual studio 2010. Whenever you put the cursor on the variable it will highlight all the code where that variable used. This is a very nice features as within one shot we can see what is done with that variable in code just like following.


Hiding selected code in Visual Studio 2010

In earlier version of Microsoft Visual Studio We can collapse the method and region. But you can not collapse the particular code block but with Visual Studio 2010 code you can hide the particular selected code via right click outlining –>Hide Selection and you can highlight code lets see first following code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Blogging
 public partial class _Default : System.Web.UI.Page
     protected void Page_Load(object sender, EventArgs e)
         if (Page.IsPostBack)
             Response.Write("Page is not postback");

         for (int i = 1; i <= 20; i++)

Now I want to hide the following Page.IsPostBack part via right click Outlining –> Hide Selection


As you can see in above image there is –(Minus) Icon so you can collapse that code Just like region. Now you want to undo the collapsing then once again you need to select the code in editor and then right click and then select Outlining->Stop Hiding Current and then it will be treated as normal code with out collapsible block Like below.


That’s it hope you liked it.. Stay tuned for more.. Happy programming..

Shout it

kick it on


Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 10+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews