﻿---
title: csharp_style_namespace_declarations
description: Convert block namespaces to file-scoped. IDE0161. Applied without a compilation. Defaults to `(as written)`
url: https://docs-v3-preview.elastic.dev/reference/modifiers-and-braces/csharp_style_namespace_declarations
---

# csharp_style_namespace_declarations
Convert block namespaces to file-scoped. IDE0161. Applied without a compilation.

## Values


| Value          | Notes |
|----------------|-------|
| `block_scoped` |       |
| `file_scoped`  |       |

**Default:** `(as written)`

### `csharp_style_namespace_declarations = block_scoped`

```ini
csharp_style_namespace_declarations = block_scoped
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    using System;

    namespace N
    {
        public class Widget
        {
            public void Run() { }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    using System;

    namespace N
    {
        public class Widget
        {
            public void Run() { }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_style_namespace_declarations = file_scoped`

```ini
csharp_style_namespace_declarations = file_scoped
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    using System;

    namespace N
    {
        public class Widget
        {
            public void Run() { }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    using System;

    namespace N;

    public class Widget
    {
        public void Run() { }
    }
    ```
  </tab-item>
</tab-set>