csharp_style_expression_bodied_methods

Convert eligible block-bodied methods to expression bodies. IDE0022. Skipped where the project compiles below C# 6, or below C# 7 for a body that only throws.

Value Notes
false
true
when_on_single_line

Default: false

No known case where Curb's output is not a fixed point of dotnet format — see conformance.

Ini
csharp_style_expression_bodied_methods = false
C#
namespace N;

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

    public int Double() { return Value * 2; }

    public string Describe() { return $"Widget({Value})"; }
}
C#
namespace N;

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

    public int Double() { return Value * 2; }

    public string Describe() { return $"Widget({Value})"; }
}
Ini
csharp_style_expression_bodied_methods = true
C#
namespace N;

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

    public int Double() { return Value * 2; }

    public string Describe() { return $"Widget({Value})"; }
}
C#
namespace N;

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

    public int Double() => Value * 2;

    public string Describe() => $"Widget({Value})";
}
Ini
csharp_style_expression_bodied_methods = when_on_single_line
C#
namespace N;

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

    public int Double() { return Value * 2; }

    public string Describe() { return $"Widget({Value})"; }
}
C#
namespace N;

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

    public int Double() => Value * 2;

    public string Describe() => $"Widget({Value})";
}