Format the Source Code Document in Visual Studio IDE

In Visual Studio IDE using the folloing shortcut you can Format (Align) the code very easily. This shortcut works in most of the file types (.cs(C#), .aspx, .html, .xml,...)

Figure 1: Visual Studio IDE - .aspx code before Formating

To Format (Align) only the selected code:
Ctrl + k, Ctrl + f

To Format (Align) the whole document:
Ctrl + k, Ctrl + d

Figure 2: Visual Studio IDE - .aspx code after Formating

You can find this 'Format Document' and 'Format Selection' options in the 'Edit' menu of Visual Studio IDE.

Figure 3: 'Format Document' option in Visual Studio IDE 'Edit' Menu

No comments: