C# autocorrects my if statements

hello i recently changed from javascript to c# and it all works great, just one problem. it autocorrects my if statements. Dont really know how to explain more in detail, but take a look at these pictures instead:

How i want it:
68361-code-1.png

How it autocorrects:
68362-code-2.png

Thanks (:

Hope this helps:

  1. In MonoDevelop menu bar click on “Project” > “Solution Options” .
  2. In the new window that appears, Open the Source Code arrow.
  3. Open the “Code Formatting” header on the left side.
  4. Click on the C# source code header
  5. On the right of the window, click on the C# format tab.
  6. Click the edit button
  7. Open the drop down “Catergory” and change it to Braces.
  8. You will now see a list of setting to alter, these will. I would suggest if you always want the bracket on the next line to set most of them to “Next Line”.

If using Monodevelop:
For the current project go to Project → Solution Options → Source Code → Code Formatting → C# Source Code → C# Format → Edit → Braces. Then play around with the settings until you find the right setup for you. For your specific question you should set them to Next Line.

If you want the settings for new projects you might make, do the same thing, but this time go to Tools → Options → Source Code → …(like before). It will only apply these settings for new projects.

Also you might want to set up a keybind in order to force the whole document to format. To do that go to Tools → Options → Hotkeys and search for “Document Format” or something like that. When you will press the key combination it will format the whole document according to the current formatting settings.