csharp_style_expression_bodied_properties

Convert an eligible single-getter property to an expression body. IDE0025. 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_properties = false
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value
    {
        get { return _value; }
    }

    public string Name
    {
        get { return "widget"; }
    }
}
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value
    {
        get { return _value; }
    }

    public string Name
    {
        get { return "widget"; }
    }
}
Ini
csharp_style_expression_bodied_properties = true
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value
    {
        get { return _value; }
    }

    public string Name
    {
        get { return "widget"; }
    }
}
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value => _value;

    public string Name => "widget";
}
Ini
csharp_style_expression_bodied_properties = when_on_single_line
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value
    {
        get { return _value; }
    }

    public string Name
    {
        get { return "widget"; }
    }
}
C#
namespace N;

public class Widget
{
    private int _value;

    public int Value
    {
        get { return _value; }
    }

    public string Name
    {
        get { return "widget"; }
    }
}