﻿---
title: csharp_indent_case_contents_when_block
description: Indent a braced case body. csharp_indent_case_contents governs other statements. Defaults to `true`
url: https://docs-v3-preview.elastic.dev/reference/indentation/csharp_indent_case_contents_when_block
---

# csharp_indent_case_contents_when_block
Indent a braced case body. csharp_indent_case_contents governs other statements.

## Values


| Value   | Notes |
|---------|-------|
| `true`  |       |
| `false` |       |

**Default:** `true`

### `csharp_indent_case_contents_when_block = true`

```ini
csharp_indent_case_contents_when_block = true
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Name(int code)
        {
            switch (code)
            {
                case 2:
                {
                var msg = "two";
                return msg;
                }
                default:
                    return "other";
            }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Name(int code)
        {
            switch (code)
            {
                case 2:
                    {
                        var msg = "two";
                        return msg;
                    }
                default:
                    return "other";
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_indent_case_contents_when_block = false`

```ini
csharp_indent_case_contents_when_block = false
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Name(int code)
        {
            switch (code)
            {
                case 2:
                    {
                        var msg = "two";
                        return msg;
                    }
                default:
                    return "other";
            }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Name(int code)
        {
            switch (code)
            {
                case 2:
                {
                    var msg = "two";
                    return msg;
                }
                default:
                    return "other";
            }
        }
    }
    ```
  </tab-item>
</tab-set>