﻿---
title: csharp_new_line_before_open_brace
description: Which constructs put their opening brace on a new line. Defaults to `all`
url: https://docs-v3-preview.elastic.dev/reference/new-lines/csharp_new_line_before_open_brace
---

# csharp_new_line_before_open_brace
Which constructs put their opening brace on a new line.

## Values


| Value                                  | Notes |
|----------------------------------------|-------|
| `all`                                  |       |
| `none`                                 |       |
| `types`                                |       |
| `methods`                              |       |
| `accessors`                            |       |
| `anonymous_types`                      |       |
| `anonymous_methods`                    |       |
| `lambdas`                              |       |
| `control_blocks`                       |       |
| `object_collection_array_initializers` |       |
| `properties`                           |       |
| `events`                               |       |

**Default:** `all`

### `csharp_new_line_before_open_brace = all`

```ini
csharp_new_line_before_open_brace = all
```

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

    public class Widget {
        public int X { get; set; }

        public void Run() {
            if (X > 0) {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = none`

```ini
csharp_new_line_before_open_brace = none
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = types`

```ini
csharp_new_line_before_open_brace = types
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = methods`

```ini
csharp_new_line_before_open_brace = methods
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = accessors`

```ini
csharp_new_line_before_open_brace = accessors
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = anonymous_types`

```ini
csharp_new_line_before_open_brace = anonymous_types
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = anonymous_methods`

```ini
csharp_new_line_before_open_brace = anonymous_methods
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = lambdas`

```ini
csharp_new_line_before_open_brace = lambdas
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = control_blocks`

```ini
csharp_new_line_before_open_brace = control_blocks
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = object_collection_array_initializers`

```ini
csharp_new_line_before_open_brace = object_collection_array_initializers
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = properties`

```ini
csharp_new_line_before_open_brace = properties
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_open_brace = events`

```ini
csharp_new_line_before_open_brace = events
```

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int X { get; set; }

        public void Run()
        {
            if (X > 0)
            {
                X--;
            }
        }
    }
    ```
  </tab-item>
</tab-set>