Loading

csharp_style_expression_bodied_methods

Convert eligible block-bodied methods to expression bodies. IDE0022.

Value Notes
false
true
when_on_single_line

Default: false

csharp_style_expression_bodied_methods = false
		
namespace N;

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

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

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

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

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

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

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

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

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

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

    public int Double() => Value * 2;

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

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

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

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

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

    public int Double() => Value * 2;

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