Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

August 10, 2010

Visual Studio: Hide Selection

Filed under: C#,VB.NET,Visual Studio @ 1:12 am

Sometimes you just want to focus on a specific piece of code and you want the rest of it just out of your way. With Visual Studio 2010, you can hide any piece of code in your application using the new Hide Selection feature.

For example, here is a piece of code in a SaveItem method:

image

It would be easier to figure out the logic in this routine if you could hide some of the detail. So select the lines you want to hide, right-click, and select Outlining | Hide Selection as shown below.

image

The selected code lines are then hidden from view and replaced with a ellipsis (…). [Circled in red below for emphasis.]

image

Use the + sign to the left of the ellipsis to open or close the selection.

Take advantage of this feature any time you want to hide away code so you can focus on the lines that matter.

Enjoy!

1 Comment

  1.   Brian Schmitt — August 10, 2010 @ 9:27 pm    Reply

    Good Post – The pics really help explain this functionality. I am glad they fixed it in 2010 – it was broken after 2005 sp1.

    I recently did a blog post about this very feature and provide a Macro that will allow you to have the same feature in 2005/2008.

    http://www.brianschmitt.com/2010/04/hide-selection-in-2010-2008-and-2005.html

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2020 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs