Link to home
Start Free TrialLog in
Avatar of Eindoofus
Eindoofus

asked on

Is there a way to change the bracket setting in MS Visual Studio?

Is there a way to change the bracket setting in MS Visual Studio? I'm using VS 2010 but I would imagine it's the same with older version. Currently Visual Studio is encouraging me to position my brackets to be like this:
if (_product == null)
{
    _product = new Product(ProductId);
}

Open in new window

But I would prefer for it to default to this:
if (_product == null) {
    _product = new Product(ProductId);
}

Open in new window

Is it possible to change the VS 2010 settings to do it my way? And if so, how?

Also, is my way considered bad practice? Or do good majority out there typically type my way as well in C#?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try Tools|Options|Text Editor
C#
- Formatting
-- New Lines
--- Place open brace on same line for control blocks
Avatar of Eindoofus
Eindoofus

ASKER

Thanks :)
I think I'm the only one in my department that even cares about indentation!! If it came down to it, you could certainly flip the appropriate switches to code in your style, and then when it came time to check-in or submit the code, you could flip them back and reformat the document in the desired format. VS does a pretty good job of indenting where expected (assuming you set your options correctly). I very much appreciate the auto-format you can enable that will indent your code as you type a closing brace (probably gives me a leg up on formatting as compared to my peers!).