How to select a block of code in Visual Studio

This is quite interesting and a handy tip. You can use it very often during your development  when you want to select a complete code block very quickly.   Keep you cursor either at the starting or at the ending braces  Just press Ctrl + Shift + ] . You will find the complete code block is  being selected.

Here is the simple steps

1.  Put the cursor  at the starting of the block

Selecting Code Block 

2. Press Ctrl + Shift + ]

Selecting Code Block

You will find the complete code block between the start and end braces has selected.

Note : If you are using VS 2013 Preview, you can use ALT Key and UP / Down Arrow to move the code block up and down.

  • Alt + Up Arrow Key  – Move the Code Block / Line Upwards
  • Alt + Down Arrow Key – Move the Code Block / Line Downwards

This is often required for code movement or refactoring code, as for example, selecting a block and moving it into a method quickly.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.