I'd like to configure the auto formatting brace styles to my preference. I've looked through all the option and can't quite get it how I like it.
Here is a sample of my preferred format:
if (condition
&& anothercondition
)
{
DoStuff();
} else {
DoOtherStuff();
}
try
{
DoBadstuff();
} catch (System.Exception ex) {
FixBadStuff();
} finally {
CleanUp();
}
So basically the opening brace should be on a newline (which I can do). But the close brace, and any subsequent but related statement, and it's opening brace should all be on a single line. i.e.
} else {
Now I can get this last part - but only if I put the initial opening brace on the same line as well.
Does anyone know any ways to achieve this?
I'm not so bothered about the formatting of && and || within the if - things like this are generally rare enough that it doesn't bother me.
You can't do this... (and personally you shouldn't it's horribly inconsistent)
VS2012 will let you change brace behaviour for entire groups of keywords. (e.g. all control block keywords) but not individual words (i.e. make Try
behave differently from catch
)