ReSharper - force curly braces around single line

Booberry picture Booberry · Sep 1, 2010 · Viewed 21.8k times · Source

Can I configure ReSharper to fix C# code when curly braces are not used to surround a single-line code block, like this:

if (blnSomeCondition)
   DoSomething();  // complain

if (blnSomeOtherCondition)
{
   DoSomethingElse(); // don't complain
}

Thanks

Answer

Sergey G. picture Sergey G. · May 7, 2016

In the new version of ReSharper (2016.x) is has been moved to the Code Style. ReSharper 2016.1.1

UPD1: for ReSharper 2017.x ReSharper 2017.1.2

UPD2: for ReSharper 2018.x ReSharper 2018.1

UPD3: for ReSharper 2019.x ReSharper 2019.1

UPD4: for ReSharper 2020.x enter image description here