views:

134

answers:

4

Seriously, I don't know what to google. Here's the thing, I like this java-like code writting:

if (condition == true) {
   doSomeStuff();
}

But VisualStudio "helps" me with his own "style", which I don't like and I am unable to change (after rather big time of desperate checking all settings :/)

if (condition == true)
{
  DoStuff();
}

I obviously want the "{" char to be in same line where condition is ...

I am using MS Visual Studio 2010 professional

Any help appreciated!

+2  A: 

Go to Tools > Options > Text Editor > [Language, i.e.: C#] > Formatting > New Lines

This is where you can set your new line options for braces.

Superstringcheese
god, how did I miss thisthanks everyone
Xorty
+1  A: 

This is for Visual Stuio 2008, so I'm not sure that it's exactly the same in VS 2010:

Go to the Tools menu and open Options. Make sure that the Show all settings checkbox is checked. Open the Text Editor node and then the node for the language you want to change the setting for. Open the Formatting node and select the New Lines node. Here you can change when new lines are added to the code.

After installing Visual Studio I go in there and uncheck every option in the New Lines section.

Guffa
+3  A: 

Tools -> Options ...

alt text

Steve Horn
+3  A: 

Text Editor > C# > Formatting > New Lines > New line options for braces

  • Uncheck Place open brace on new line for control blocks.
  • Probably want to uncheck put else on newline as well.
jessicah