Over a million developers have joined DZone.

Box Selection in Visual Studio 2010

·

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.

Topics:

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}