When creating conditional statements, or mthods, the IDE jumps to this:
if (true)
{
//code here
}
But I’d prefer the following more compact style (and often used in text books)
if (true) {
//code here
}
Is there a setting in visual studio to change the default style?
Go
Tools>Optionsin the top menu bar.In the left panel, go to
Text Editor>C#>Code Style>Formatting>New Lines.The option for
ifblocks isPlace open brace on new line for control blocks, but you may want to change it for other types of block too. You may also want to changePlace "else" on new line.