What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?

后端 未结 7 860
说谎
说谎 2020-12-13 16:54

In Eclipse, selecting a line and pressing Alt + / will move the line up and down, a quick way to avoid copy&paste. Is there

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 17:32

    In Visual Studio 2013 and later, you can move lines up and down using Alt + / Alt + . Unfortunately this will not adjust the indentation if you move between blocks, as of today only ReSharper (and all other IDE's by Jetbrains including Rider) can help you with that.

    To move entire blocks of code around you can move the cursor to its head and press Ctrl + m twice fast to collapse it, and then use the command above to move it around.

    Here is a neat reference to all default keyboard shortcuts in different versions of Visual Studio.

提交回复
热议问题