csharp_new_line_before_open_brace
Which constructs put their opening brace on a new line.
| Value | Notes |
|---|---|
all |
|
none |
|
types |
|
methods |
|
accessors |
|
anonymous_types |
|
anonymous_methods |
|
lambdas |
|
control_blocks |
|
object_collection_array_initializers |
Moves an object initializer's brace. A collection or array initializer's brace stays where it was written, as in dotnet format. |
properties |
|
events |
Accepted, but moves no brace on its own: an event's braces follow properties, as in dotnet format. |
Default: all
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: Same fallback-mismatch shape as csharp_indent_labels: Curb falls back to the documented default (all/Allman) for an unrecognised value. Measured: dotnet format leaves the source untouched for the same unrecognised value, i.e. it silently skips applying the setting rather than falling back to its own documented default. (
NewLineBeforeOpenBraceTests.An_unrecognised_value_falls_back_to_the_default) - ide0055: Same fallback-mismatch divergence as the dotnet-format-whitespace entry above (Curb falls back to the documented default for an unrecognised value; dotnet format's own fallback for the same invalid value disagrees), now confirmed to reproduce under a real, analyzer-driven
dotnet build -p:EnforceCodeStyleInBuild=truetoo, not just thedotnet format whitespaceCLI — expected, since IDE0055 is the same underlying Roslyn formatting engine. (NewLineBeforeOpenBraceTests.An_unrecognised_value_falls_back_to_the_default)
csharp_new_line_before_open_brace = all
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
csharp_new_line_before_open_brace = none
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = types
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget
{
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = methods
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run()
{
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = accessors
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed {
add
{
}
remove
{
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = anonymous_types
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = anonymous_methods
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = lambdas
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
csharp_new_line_before_open_brace = control_blocks
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0)
{
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = object_collection_array_initializers
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = properties
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X
{
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed
{
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}
csharp_new_line_before_open_brace = events
using System;
namespace N;
public class Widget
{
private int _x;
public int X
{
get
{
return _x;
}
set
{
_x = value;
}
}
public event EventHandler Changed
{
add
{
}
remove
{
}
}
public void Run()
{
if (X > 0)
{
X--;
}
var point = new
{
X = 1,
};
var copy = new Widget
{
X = 1,
};
Action log = delegate
{
Console.WriteLine(point);
};
Func<int, int> twice = n =>
{
return n * 2;
};
}
}
using System;
namespace N;
public class Widget {
private int _x;
public int X {
get {
return _x;
}
set {
_x = value;
}
}
public event EventHandler Changed {
add {
}
remove {
}
}
public void Run() {
if (X > 0) {
X--;
}
var point = new {
X = 1,
};
var copy = new Widget {
X = 1,
};
Action log = delegate {
Console.WriteLine(point);
};
Func<int, int> twice = n => {
return n * 2;
};
}
}