csharp_style_expression_bodied_properties
Convert an eligible single-getter property to an expression body. IDE0025.
| Value | Notes |
|---|---|
false |
|
true |
|
when_on_single_line |
Default: false
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"; } }
}