.NET Zone is brought to you in partnership with:

I am former Microsoft MVP for Visual C# having 9 Year of experience in Microsoft.NET And other Microsoft Technologies. Please fill free to contact me at www.dotnetjalps.com Jalpesh is a DZone MVB and is not an employee of DZone and has posted 60 posts at DZone. You can read more from them at their website. View Full User Profile

Box Selection in Visual Studio 2010

07.25.2011
| 2758 views |
  • submit to reddit

Every day I am discovering something new with Visual Studio 2010 and In this post I am again going to explain you new interesting feature of Visual Studio 2010. We all required to modify the code in bulk some time and there is a new features for Visual Studio 2010 which enables to made changes in multiple line at same time. Let’s take a simple example like following.

using System;
 
namespace Parallel
{
  class Program
  {
         private int a=10;
         private int b=10;
         private int c=10;
 
         static void Main(string[] args)
         {
 
         }  
  }
}

In above code I have three private variable a,b and c and now I want to make them protected. There is two way either I do manually one by one or I can do it with box selection and modify them together. It very easy to use this feature Press ALT+ SHIFT and draw box with help of mouse on the code which you need to modify like following.

SelectedBox

Now I want to make it protected so I started writing protected and it will modify all the line at same time like following.

ChangedCode

And now my code is like following.

using System;
 
namespace Parallel
{
  class Program
  {
         protected int a=10;
         protected int b=10;
         protected int c=10;
 
         static void Main(string[] args)
         {
 
         }  
  }
}

That's it. Hope you like it… Stay tuned for more…Till then Happy programming.

References
Published at DZone with permission of Jalpesh Vadgama, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)