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.




Shout itkick it on DotNetKicks.com

4 comments :

  1. Nice post. But you will find several for this if you google.

    ReplyDelete
  2. Thanks I am writing for my blog readers and Here I am expressing my experience with Visual Studio 2010.

    ReplyDelete
  3. Thanks jaggu. This is an excellent article.

    ReplyDelete

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