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, so on its own it is inert to dotnet format (verified:
togetheralone survives). The divergence only 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=trueas well as thedotnet format whitespaceCLI. (EmptyBlockStyleTests.Together_ignores_preserve_single_line_blocks_being_off)
csharp_empty_block_style = multiline
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty() { }
}
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty()
{
}
}
csharp_empty_block_style = together
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty() { }
}
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty()
{ }
}
csharp_empty_block_style = together_same_line
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty() { }
}
namespace N;
public class Widget
{
public int X { get; set; }
public string Name { get; set; } = "";
public void Empty() { }
}