I find the default bracing style a bit wasteful on line count eg...
function foo() { if (...) { ... } else { ... } }
would, if I was writing in JavaScript for example be written like...
function foo() { if (...) { ... } else { ... } }
...which I understand may also not be to peoples' tastes.
But the question(s) is/are do you turn off the VS formatting style and use your own rules? What is the opinion of this in the industry when many people are working on the same code-base? Is it better just to stick to the default just for simplicity/uniformity?
Code style preferences can be set for all of your C# and Visual Basic projects by opening the Options dialog box from the Tools menu. In the Options dialog box, select Text Editor > [C# or Basic] > Code Style > General.
On Windows/Linux - File > Preferences > Settings.
Microsoft documentation from August 2021 says: "For C# code files, Visual Studio 2019 has a Code Cleanup button at the bottom of the editor (keyboard: Ctrl+K, Ctrl+E) to apply code styles from an EditorConfig file or from the Code Style options page.
You need to have coding standards. There are no best standards. Standards such as having a brace on its own line or on the same line is a decision that one may take looking at comfort level of developers involved rather than on industry opinion (which will be typically divided).
But once standard is defined, you should adjust your tool to suit you. For example, you can change VS settings (Tools -> Option) as per your standards and then export those option groups as .vssettings file, keep it at central location/code repository and ask every dev to import it.
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