In Eclipse there is a shortcut, Ctrl+Shift+F, that re-indents code and fixes comments and blank lines. Is there an equivalent for Visual Studio 2010?
C# – format code shortcut for Visual Studio
cvisual studiovisual studio 2010visual studio 2012visual-studio-2013
Related Topic
- Git – .gitignore for Visual Studio Projects and Solutions
- Visual-studio – Visual Studio : short cut Key : Duplicate Line
- Visual-studio – “stdafx.h” used for in Visual Studio
- Visual-studio – How to auto format code in Visual Studio
- .net – How to run Visual Studio as an administrator by default
- Visual-studio – Error ‘LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt’ after installing Visual Studio 2012 Release Preview
- Visual-studio – Can you force Visual Studio to always run as an Administrator in Windows 8
Best Answer
Visual Studio with C# key bindings
To answer the specific question, in C# you are likely to be using the C# keyboard mapping scheme, which will use these hotkeys by default:
Ctrl+E, Ctrl+D to format the entire document.
Ctrl+E, Ctrl+F to format the selection.
You can change these in menu Tools → Options → Environment → Keyboard (either by selecting a different "keyboard mapping scheme", or binding individual keys to the commands "Edit.FormatDocument" and "Edit.FormatSelection").
If you have not chosen to use the C# keyboard mapping scheme, then you may find the key shortcuts are different. For example, if you are not using the C# bindings, the keys are likely to be:
Ctrl + K + D (Entire document)
Ctrl + K + F (Selection only)
To find out which key bindings apply in your copy of Visual Studio, look in menu Edit → Advanced menu - the keys are displayed to the right of the menu items, so it's easy to discover what they are on your system.
(Please do not edit this answer to change the key bindings above to what your system has!)