In Eclipse, selecting a line and pressing Alt + ↑/↓ will move the line up and down, a quick way to avoid copy&paste. Is there an equivalent in Visual Studio?
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- Eclipse and Mylyn : how to disable grey files in t
相关文章
- 使用Webstorm打开刚下载的jquery为什么会有报错
- selenium+eclipse 打开网页时报错
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Eclipse failing to open
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Eclipse how can I indent C++ preprocessor macros
With the VSCommands extension, you have exactly that keyboard shortcut. And, by the way, a Stack OVerflow notification toolbar :)
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.
ReSharper's Ctrl + Shift + Alt + ↑/↓/←/→ is even more powerful - when on the beginning of the line, it will move the entire line, but can also be used to move entire methods, change the order of parameters, etc.
This is now working out of the box with Visual Studio 2013, same way as in Eclipse.
In Visual Studio 2013 & 2015, this functionality is built in. ALT + UP/DOWN will move a line up or down.
If you need this functionality in VS2012 (works with VS2010 too), take a look at the MoveLine Visual Studio Extension or the Productivity Power Tools suite.