Go to Tool Option , then General Text editor C++ Formatting New lines .
Select the following settings:
- Opening bracket position for control unit: switch for the same line
- Keyword Position: Uncheck the else character on a new line.
A preview of this last setting will display
if (a < b) { } else { }
but this does not take into account the first option.
If you enter the if / else statement, select a region and ask the editor to reformat. The statement will look like:
if (test) { } else { }
I could try it successfully at Visual Studio 2015. I tested it in a foreign language, so the English wording of the above options may be slightly different, but close enough to be found.
source share