Monset
Monset

Reputation: 657

Visual Studio C# blocks not formatting normally on "enter"

Note that | represents my cursor

When I type in

public void test()|

and then hit the { in the same row, like this:

public void test(){|

a } is inserted after.

Now I have this:

public void test(){|}

Now I click Enter to go to the next row, and I expect the { to go one line below, like this:

public void test()
{
    |
}

but this is what I get:

public void test(){
    |}

How do I get the result I want?

Upvotes: 0

Views: 61

Answers (1)

FeRaaC
FeRaaC

Reputation: 486

You go to Tools > Options > Text Editor > C# > Code Style > Formating > New Lines and customize the formatting as you like it.

In your case the option "Place open brace on new line for ..." is important.

EDIT: Also if you want to have the closing brace indented like in your example then you can do this under Indentation

Upvotes: 1

Related Questions