If you have Power Commands installed you can then go to the Tools->Options->Power Commands and make sure "Format Document on Save" is selected. Whenever you save the edited file the Curly Braces will be auto aligned.
Braces are totally not worth separate line. The thing is that braces are not important.
C#
And there check when you want new lines with brackets
Css:
almost the same, but fewer options
And than you select the formatting you want (in your case second radio button)
For Visual Studio 2015:
Tools → Options
In the sidebar, go to Text Editor → C# → Formatting → New Lines
and uncheck every checkbox in the section "New line options for braces"
For Mac OS users:
Preferences → Source Code → Code Formatting → choose what ever you want to change (like C# source code) → C# Format → Edit -→ New Lines
Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines -> New Line Options for braces -> Uncheck all boxes.
The official MS guidelines (at the time in 2008) tells you to have the curly brace on the same line as the method/property/class and many other things which are not enforced in Visual Studio.
You can change all these auto-text settings under:
Tools -> Options -> Text Editor -> [The language you want to change]
UPDATE: This was based on the book "Framework Design Guidelines" written by some of the core-people from the .NET-team. If you look at the source-code for the likes of ASP.NET MVC, this is no longer accurate.
Go to Tools -> Options -> Text Editor -> CSS -> Formatting
. Click "Semi-expanded," which matches the style you defined.
For CSS you'll need the 'Semi Expanded' option.
There is a specific formatting setting in VS 2008/2010 to keep the open brace on the same line:
Click Tools->Options
Select 'CSS' within 'Text Editor' tree node
Select 'Formatting' under 'CSS' node
Click 'Semi-expanded' radio button
You will see a preview what the various radio buttons avail will do to the formatting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With