Monday, April 1, 2013

Visual Studio Trick - Block Edit Code

I love Visual Studio 2012 and the improvements made in it.  You can check out my post on Visual Studio 2012 goes search first here.  However there are some features which are hidden and aren't much talked about.  And these features were there even before Visual Studio 2012.  My favorite one it how you can block edit your code using this trick.  I have always been a fan of this trick.  It has saved me a lot of typing.  Find and Replace is not always useful and quick.  I have recorded my first video demonstrating this trick which is embedded below.  

This trick can be very helpful when you have to edit a block of text at once.  You can select a block of text by pressing the Alt key and select a piece of code with your mouse. Once you have selected the text you can type or delete that piece of text.  You can also use your keyboard to select a block of code and edit.  Just press Shift + Alt + Down Arrow to select number of lines and keep Shift + Alt pressed and then press Right Arrow to select the number of characters in those lines and then simply edit.  Check out this video below.