If statement braces format

Hello,

 

Is it possible to get Resharper to apply braces style that matches these conditions?

 

- The braces should always match for all branches of an if statement ("Enforce if any part requires braces")

 

Allow this:

if (something)

    foreach (var x in something)

         DoSomething();

 

But force this:

if (something)

{

    foreach (var x in something)

    {

        // Because the foreach is using braces, the if statement should too

        DoSomething();

        DoSomething();

    }

}

 

 

1 comment

Hello Sdrew1!

 

Thank you for contacting us.

There's no such option in R#, still the specified behavior can be achieved by setting ReSharper | Options | Code Edtiting | C# | Code Style | Braces | In 'if' statement and  In 'foreach' statement to Enforce Always.

Thank you.

0

Please sign in to leave a comment.