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.
csharp_style_expression_bodied_properties = false
namespace N;
public class Widget
{
private int _value;
public int Value
{
get { return _value; }
}
public string Name
{
get { return "widget"; }
}
}
namespace N;
public class Widget
{
private int _value;
public int Value
{
get { return _value; }
}
public string Name
{
get { return "widget"; }
}
}
csharp_style_expression_bodied_properties = true
namespace N;
public class Widget
{
private int _value;
public int Value
{
get { return _value; }
}
public string Name
{
get { return "widget"; }
}
}
namespace N;
public class Widget
{
private int _value;
public int Value => _value;
public string Name => "widget";
}
csharp_style_expression_bodied_properties = when_on_single_line
namespace N;
public class Widget
{
private int _value;
public int Value
{
get { return _value; }
}
public string Name
{
get { return "widget"; }
}
}
namespace N;
public class Widget
{
private int _value;
public int Value
{
get { return _value; }
}
public string Name
{
get { return "widget"; }
}
}