csharp_style_expression_bodied_operators

Convert eligible block-bodied operators. IDE0023/IDE0024. 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_operators = false
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator+(Widget a, Widget b) { return new Widget(a.Value + b.Value); }
}
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator +(Widget a, Widget b) { return new Widget(a.Value + b.Value); }
}
Ini
csharp_style_expression_bodied_operators = true
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator +(Widget a, Widget b) { return new Widget(a.Value + b.Value); }
}
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator +(Widget a, Widget b) => new Widget(a.Value + b.Value);
}
Ini
csharp_style_expression_bodied_operators = when_on_single_line
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator +(Widget a, Widget b) { return new Widget(a.Value + b.Value); }
}
C#
namespace N;

public class Widget
{
    public int Value { get; }

    public Widget(int value) { Value = value; }

    public static Widget operator +(Widget a, Widget b) => new Widget(a.Value + b.Value);
}