﻿---
title: csharp_style_expression_bodied_local_functions
description: Convert eligible block-bodied local functions. IDE0061. Defaults to `false`
url: https://docs-v3-preview.elastic.dev/reference/expression-bodies/csharp_style_expression_bodied_local_functions
---

# csharp_style_expression_bodied_local_functions
Convert eligible block-bodied local functions. IDE0061.

## Values


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

**Default:** `false`

### `csharp_style_expression_bodied_local_functions = false`

```ini
csharp_style_expression_bodied_local_functions = false
```

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) { return x + y; }
            return Add(a, b);
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) { return x + y; }
            return Add(a, b);
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_style_expression_bodied_local_functions = true`

```ini
csharp_style_expression_bodied_local_functions = true
```

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) { return x + y; }
            return Add(a, b);
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) => x + y;
            return Add(a, b);
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_style_expression_bodied_local_functions = when_on_single_line`

```ini
csharp_style_expression_bodied_local_functions = when_on_single_line
```

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) { return x + y; }
            return Add(a, b);
        }
    }
    ```
  </tab-item>

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

    public class Widget
    {
        public int Compute(int a, int b)
        {
            int Add(int x, int y) => x + y;
            return Add(a, b);
        }
    }
    ```
  </tab-item>
</tab-set>