.NET Power Tip 19: Copying, Cutting, Pasting and Moving Lines in Visual Studio

I watch many developers deleting and copying code lines in Visual Studio in an unnecessary complicated procedure. They place the cursor inside the line that they need to delete, cut or copy. Then they use either the mouse or the keyboard to expand the selection to the entire line. With the keyboard, that would be: Hold SHIFT, hit HOME, hit END and the entire line is selected. Then they continue with CTRL-X, CTRL-C, etc.

This fiddling with the keys is totally unnecessary.

Whenever the cursor is at any position in the correct line, you can just use CTRL-X or CTRL-C and Visual Studio will AUTOMATICALLY cut or copy the entire line. Expanding the selection to the beginning and the end of the line is unnecessary.  Smile

copylines

Moving lines is even simpler!

Just place the cursor anywhere in the line to be moved, hold the ALT key and use the cursors UP and DOWN to move the line…tadaaa…

moveLines