Michael Warner
Michael Warner

Reputation: 464

Visual Studio switch statement formatting

I'm using Visual Studio 2005. It always wants to format switch statements like this:

switch (thing)
{
case A:
  stuff;
  break;

case B:
  things;
  break;
}

Is there a way to have it indent the cases like this?:

switch (thing)
{
  case A:
    stuff;
    break;

  case B:
    things;
    break;
}

Upvotes: 39

Views: 19985

Answers (3)

SithLizard
SithLizard

Reputation: 55

An updated method of doing this, it's not too different.

Tools > Options > Text Editor > (Language) > Code Style > Formatting > Indentation > Indent case labels

Upvotes: 5

Mez
Mez

Reputation: 2857

Tools | Options | Text Editor | c# -> check 'Ident block contents' checkbox.

Upvotes: 0

Andrew Hare
Andrew Hare

Reputation: 351596

Go here:

Tools > Options > Text Editor > C# > Formatting > Indentation > Indent case labels

Upvotes: 60

Related Questions