Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make Visual Studio 2017 stop indenting braces for case?

Visual Studio indents braces in case like this:

switch(variable)
{
    case 0:
        {
            // some code
            break;
        }
}

However I would like it better without indentation:

switch(variable)
{
    case 0:
    {
        // some code
        break;
    }
}

I was looking through the options, but didn't find the one I want. Did I miss it or is it just not there?

like image 299
Tom Avatar asked Jan 30 '23 18:01

Tom


1 Answers

Under Visual Studio

Options >> TextEditor >> C# >> Code Style >> Formatting >> Indentation

is what you are looking for. You will see several options under that menu and set your settings as you wish. In this case, the setting is called "Indent case contents".

like image 81
Gonzales Gokhan Avatar answered Feb 02 '23 10:02

Gonzales Gokhan