csharp_empty_block_style

How an empty method, constructor, accessor or control-flow body is laid out. together_same_line keeps { } on the signature's line.

Value Notes
multiline
together
together_same_line

Default: (not set)

Curb's output is not always a fixed point of the tool(s) below for this key — see conformance divergences for the full registry.

  • dotnet-format-whitespace: csharp_empty_block_style is a ReSharper-only key dotnet format does not recognise at all, but that does not make it inert: what it asks for still has to survive the IDE0055 keys dotnet format does read. Alone it does (verified: together alone survives). With csharp_preserve_single_line_statements = false it survives only because Curb defers to that key: dotnet format moves a statement's body, an empty { } included, off its header's line, so together_same_line leaves an empty if/else/loop/using/lock/fixed/try/unsafe body where csharp_new_line_before_open_brace puts it rather than joining it (issue #131; EmptyBlockStyleTests.An_empty_statement_body_stays_off_its_header_line_when_statements_are_not_preserved). The divergence that remains appears combined with csharp_preserve_single_line_blocks = false, an IDE0055 key dotnet format does understand as 'expand every single-line block' — including the empty one Curb just recollapsed under the together opinion. The two options are in permanent, direct conflict whenever both are set this way; there is no shape Curb could choose that satisfies both at once. (EmptyBlockStyleTests.Together_ignores_preserve_single_line_blocks_being_off)
  • ide0055: Same direct conflict as the dotnet-format-whitespace entry above between csharp_empty_block_style and csharp_preserve_single_line_blocks = false, now confirmed to reproduce under a real dotnet build -p:EnforceCodeStyleInBuild=true as well as the dotnet format whitespace CLI. (EmptyBlockStyleTests.Together_ignores_preserve_single_line_blocks_being_off)
Ini
csharp_empty_block_style = multiline
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty() { }
}
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty()
    {
    }
}
Ini
csharp_empty_block_style = together
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty() { }
}
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty()
    { }
}
Ini
csharp_empty_block_style = together_same_line
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty() { }
}
C#
namespace N;

public class Widget
{
    public int X { get; set; }
    public string Name { get; set; } = "";
    public void Empty() { }
}