Loading

csharp_trailing_comma_in_singleline_lists

Add a trailing comma after the last element even when the list is on one line.

Value Notes
true
false

Default: false

csharp_trailing_comma_in_singleline_lists = true
		
namespace N;

public class Widget
{
    public void Run()
    {
        var list = new List<int> { 1, 2, 3 };
        Register("curb", 42, true, "formatter");
    }

    private void Register(string a, int b, bool c, string d) { }
}
		
namespace N;

public class Widget
{
    public void Run()
    {
        var list = new List<int> { 1, 2, 3, };
        Register("curb", 42, true, "formatter");
    }

    private void Register(string a, int b, bool c, string d) { }
}
		
csharp_trailing_comma_in_singleline_lists = false
		
namespace N;

public class Widget
{
    public void Run()
    {
        var list = new List<int> { 1, 2, 3 };
        Register("curb", 42, true, "formatter");
    }

    private void Register(string a, int b, bool c, string d) { }
}
		
namespace N;

public class Widget
{
    public void Run()
    {
        var list = new List<int> { 1, 2, 3 };
        Register("curb", 42, true, "formatter");
    }

    private void Register(string a, int b, bool c, string d) { }
}