csharp_prefer_braces

Add braces to unbraced control-flow bodies. IDE0011. Applied without a compilation.

Value Notes
false
true
when_multiline

Default: false

No known case where Curb's output is not a fixed point of dotnet format — see conformance.

Ini
csharp_prefer_braces = false
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
            return "positive";
        else if (n < 0)
            return "negative";
        else
            return "zero";
    }
}
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
            return "positive";
        else if (n < 0)
            return "negative";
        else
            return "zero";
    }
}
Ini
csharp_prefer_braces = true
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
            return "positive";
        else if (n < 0)
            return "negative";
        else
            return "zero";
    }
}
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
        {
            return "positive";
        }
        else if (n < 0)
        {
            return "negative";
        }
        else
        {
            return "zero";
        }
    }
}
Ini
csharp_prefer_braces = when_multiline
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
            return "positive";
        else if (n < 0)
            return "negative";
        else
            return "zero";
    }
}
C#
namespace N;

public class Widget
{
    public string Classify(int n)
    {
        if (n > 0)
            return "positive";
        else if (n < 0)
            return "negative";
        else
            return "zero";
    }
}