I’m writing this quick post because a number of people have been watching me edit code in VS and have been surprised when they see me do this, not realizing this functionality exists.
In the editor, hitting Ctrl-C while nothing is selected will copy the entire line that the text cursor is currently on. Now pressing Ctrl-V will insert that line above the text cursor (plus a newline). Using Ctrl-X instead of Ctrl-C will do the same thing except it will cut instead of copy the current line.
Give it a try, it’s a nifty trick that can often save a lot of keystrokes.
I have confirmed that this behaviour exists in Visual Studio 2008, 2010 and 2012. It’s probably there in 2005 and earlier but I haven’t checked.