JetBrains Rider 2024.1 Help

EditorConfig properties for C#: Blank Lines

This page lists custom JetBrains Rider EditorConfig properties that you can use to configure formatting preferences in C#, specifically, whether JetBrains Rider should increase or decrease the number of blank lines around namespaces, members, regions and groups of import directives.

General

Around region

Property names:

[resharper_]csharp_blank_lines_around_region, [resharper_]blank_lines_around_region

Possible values:

an integer

Examples:

value: 0

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

value: 1

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

value: 2

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

Inside region

Property names:

[resharper_]csharp_blank_lines_inside_region, [resharper_]blank_lines_inside_region

Possible values:

an integer

Examples:

value: 0

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

value: 1

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

value: 2

abstract class C { protected abstract void Method1(); #region Region Description protected abstract void Method2(); #endregion protected abstract void Method3(); }

Before single-line comment

Property names:

[resharper_]csharp_blank_lines_before_single_line_comment, [resharper_]blank_lines_before_single_line_comment

Possible values:

an integer

Examples:

value: 0

void Foo() { var x = 5; // comment Call(); ////CommentedCall(); }

value: 1

void Foo() { var x = 5; // comment Call(); ////CommentedCall(); }

value: 2

void Foo() { var x = 5; // comment Call(); ////CommentedCall(); }

Blank lines in declarations

Keep max blank lines in declarations

Property names:

[resharper_]csharp_keep_blank_lines_in_declarations, [resharper_]keep_blank_lines_in_declarations

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

class C { void Method1() {} void Method1() {} }
class C { void Method1() { } void Method1() { } }

Before formatting

After formatting, value: 1

class C { void Method1() {} void Method1() {} }
class C { void Method1() { } void Method1() { } }

Before formatting

After formatting, value: 2

class C { void Method1() {} void Method1() {} }
class C { void Method1() { } void Method1() { } }

Remove blank lines after '{' and before '}' in declarations

Property names:

[resharper_]csharp_remove_blank_lines_near_braces_in_declarations, [resharper_]remove_blank_lines_near_braces_in_declarations

Possible values:

true | false

Examples:

Before formatting

After formatting, true

class C { void Method1() {} void Method1() {} }
class C { void Method1() { } void Method1() { } }

Before formatting

After formatting, false

class C { void Method1() {} void Method1() {} }
class C { void Method1() { } void Method1() { } }

After file header comment

Property names:

[resharper_]csharp_blank_lines_after_start_comment, [resharper_]blank_lines_after_start_comment

Possible values:

an integer

Examples:

value: 0

// Header text class A { }

value: 1

// Header text class A { }

value: 2

// Header text class A { }

Between different 'using' groups

Property names:

[resharper_]csharp_blank_lines_between_using_groups, [resharper_]blank_lines_between_using_groups

Possible values:

an integer

Examples:

value: 0

using System; using System.Collections; using myNamespace;

value: 1

using System; using System.Collections; using myNamespace;

value: 2

using System; using System.Collections; using myNamespace;

After 'using' list

Property names:

[resharper_]csharp_blank_lines_after_using_list, [resharper_]blank_lines_after_using_list

Possible values:

an integer

Examples:

value: 0

using System; namespace N { }

value: 1

using System; namespace N { }

value: 2

using System; namespace N { }

Around namespace

Property names:

[resharper_]csharp_blank_lines_around_namespace, [resharper_]blank_lines_around_namespace

Possible values:

an integer

Examples:

value: 0

namespace N1 { } namespace N2 { }

value: 1

namespace N1 { } namespace N2 { }

value: 2

namespace N1 { } namespace N2 { }

Inside namespace

Property names:

[resharper_]csharp_blank_lines_inside_namespace, [resharper_]blank_lines_inside_namespace

Possible values:

an integer

Examples:

value: 0

namespace N1 { class C1 { } class C2 { } }

value: 1

namespace N1 { class C1 { } class C2 { } }

value: 2

namespace N1 { class C1 { } class C2 { } }

After file-scoped namespace directive

Property names:

[resharper_]csharp_blank_lines_after_file_scoped_namespace_directive, [resharper_]blank_lines_after_file_scoped_namespace_directive

Possible values:

an integer

Examples:

value: 0

namespace N1; class C1 { } class C2 { }

value: 1

namespace N1; class C1 { } class C2 { }

value: 2

namespace N1; class C1 { } class C2 { }

Around type

Property names:

[resharper_]csharp_blank_lines_around_type, [resharper_]blank_lines_around_type

Possible values:

an integer

Examples:

value: 0

class C1 { int a; } class C2 { int a; } class C3 { int a; }

value: 1

class C1 { int a; } class C2 { int a; } class C3 { int a; }

value: 2

class C1 { int a; } class C2 { int a; } class C3 { int a; }

Around single-line type

Property names:

[resharper_]csharp_blank_lines_around_single_line_type, [resharper_]blank_lines_around_single_line_type

Possible values:

an integer

Examples:

value: 0

delegate int MyDelegate(int a); delegate int MyDelegate2(int a); delegate int MyDelegate3(int a);

value: 1

delegate int MyDelegate(int a); delegate int MyDelegate2(int a); delegate int MyDelegate3(int a);

value: 2

delegate int MyDelegate(int a); delegate int MyDelegate2(int a); delegate int MyDelegate3(int a);

Inside type

Property names:

[resharper_]csharp_blank_lines_inside_type, [resharper_]blank_lines_inside_type

Possible values:

an integer

Examples:

value: 0

class C { int x; int y; }

value: 1

class C { int x; int y; }

value: 2

class C { int x; int y; }

Around field

Property names:

[resharper_]csharp_blank_lines_around_field, [resharper_]blank_lines_around_field

Possible values:

an integer

Examples:

value: 0

class C { /// <summary>x description</summary> int x; /// <summary>y description</summary> int y; }

value: 1

class C { /// <summary>x description</summary> int x; /// <summary>y description</summary> int y; }

value: 2

class C { /// <summary>x description</summary> int x; /// <summary>y description</summary> int y; }

Around single line field

Property names:

[resharper_]csharp_blank_lines_around_single_line_field, [resharper_]blank_lines_around_single_line_field

Possible values:

an integer

Examples:

value: 0

class C { int x; int y; }

value: 1

class C { int x; int y; }

value: 2

class C { int x; int y; }

Around property/event

Property names:

[resharper_]csharp_blank_lines_around_property, [resharper_]blank_lines_around_property

Possible values:

an integer

Examples:

value: 0

class C { /// <summary>x description</summary> public int X { get { return 1; } } /// <summary>y description</summary> public int Y { get { return 2; } } }

value: 1

class C { /// <summary>x description</summary> public int X { get { return 1; } } /// <summary>y description</summary> public int Y { get { return 2; } } }

value: 2

class C { /// <summary>x description</summary> public int X { get { return 1; } } /// <summary>y description</summary> public int Y { get { return 2; } } }

Around single line property/event

Property names:

[resharper_]csharp_blank_lines_around_single_line_property, [resharper_]blank_lines_around_single_line_property

Possible values:

an integer

Examples:

value: 0

class C { public int X { get { return 1; } } public int Y { get { return 2; } } }

value: 1

class C { public int X { get { return 1; } } public int Y { get { return 2; } } }

value: 2

class C { public int X { get { return 1; } } public int Y { get { return 2; } } }

Around auto/abstract property/event

Property names:

[resharper_]csharp_blank_lines_around_auto_property, [resharper_]blank_lines_around_auto_property

Possible values:

an integer

Examples:

value: 0

class C { /// <summary>x description</summary> public int X { get; set; } /// <summary>x description</summary> public int Y { get; set; } }

value: 1

class C { /// <summary>x description</summary> public int X { get; set; } /// <summary>x description</summary> public int Y { get; set; } }

value: 2

class C { /// <summary>x description</summary> public int X { get; set; } /// <summary>x description</summary> public int Y { get; set; } }

Around single line auto/abstract property/event

Property names:

[resharper_]csharp_blank_lines_around_single_line_auto_property, [resharper_]blank_lines_around_single_line_auto_property

Possible values:

an integer

Examples:

value: 0

class C { public int X { get; set; } public int Y { get; set; } }

value: 1

class C { public int X { get; set; } public int Y { get; set; } }

value: 2

class C { public int X { get; set; } public int Y { get; set; } }

Around property/event accessor

Property names:

[resharper_]csharp_blank_lines_around_accessor, [resharper_]blank_lines_around_accessor

Possible values:

an integer

Examples:

value: 0

class C { public int X { get { DoSomething(); return 1; } set { DoSomething(); myField = value; } } }

value: 1

class C { public int X { get { DoSomething(); return 1; } set { DoSomething(); myField = value; } } }

value: 2

class C { public int X { get { DoSomething(); return 1; } set { DoSomething(); myField = value; } } }

Around single line property/event accessor

Property names:

[resharper_]csharp_blank_lines_around_single_line_accessor, [resharper_]blank_lines_around_single_line_accessor

Possible values:

an integer

Examples:

value: 0

class C { public int X { get { return 1; } set { myField = value; } } }

value: 1

class C { public int X { get { return 1; } set { myField = value; } } }

value: 2

class C { public int X { get { return 1; } set { myField = value; } } }

Around method

Property names:

[resharper_]csharp_blank_lines_around_invocable, [resharper_]blank_lines_around_invocable

Possible values:

an integer

Examples:

value: 0

class C { void Method1() { foo(); foo2(); } void Method2() { foo(); foo2(); } }

value: 1

class C { void Method1() { foo(); foo2(); } void Method2() { foo(); foo2(); } }

value: 2

class C { void Method1() { foo(); foo2(); } void Method2() { foo(); foo2(); } }

Around single line method

Property names:

[resharper_]csharp_blank_lines_around_single_line_invocable, [resharper_]blank_lines_around_single_line_invocable

Possible values:

an integer

Examples:

value: 0

abstract class C { abstract void Method1(); abstract void Method2(); }

value: 1

abstract class C { abstract void Method1(); abstract void Method2(); }

value: 2

abstract class C { abstract void Method1(); abstract void Method2(); }

Blank lines in code

Keep max blank lines in code

Property names:

[resharper_]csharp_keep_blank_lines_in_code, [resharper_]keep_blank_lines_in_code

Possible values:

an integer

Examples:

Before formatting

After formatting, value: 0

void Method() { foo(); foo(); }
void Method() { foo(); foo(); }

Before formatting

After formatting, value: 1

void Method() { foo(); foo(); }
void Method() { foo(); foo(); }

Before formatting

After formatting, value: 2

void Method() { foo(); foo(); }
void Method() { foo(); foo(); }

Remove blank lines after '{' and before '}' in code

Property names:

[resharper_]csharp_remove_blank_lines_near_braces_in_code, [resharper_]remove_blank_lines_near_braces_in_code

Possible values:

true | false

Examples:

Before formatting

After formatting, true

void Method() { foo(); foo(); }
void Method() { foo(); foo(); }

Before formatting

After formatting, false

void Method() { foo(); foo(); }
void Method() { foo(); foo(); }

Around local function

Property names:

[resharper_]csharp_blank_lines_around_local_method, [resharper_]blank_lines_around_local_method

Possible values:

an integer

Examples:

value: 0

void Method() { void LocalFunction1() { foo(); foo2(); } void LocalFunction2() { foo(); foo2(); } }

value: 1

void Method() { void LocalFunction1() { foo(); foo2(); } void LocalFunction2() { foo(); foo2(); } }

value: 2

void Method() { void LocalFunction1() { foo(); foo2(); } void LocalFunction2() { foo(); foo2(); } }

Around single line local function

Property names:

[resharper_]csharp_blank_lines_around_single_line_local_method, [resharper_]blank_lines_around_single_line_local_method

Possible values:

an integer

Examples:

value: 0

void Method() { void LocalFunction1() { } void LocalFunction2() { } }

value: 1

void Method() { void LocalFunction1() { } void LocalFunction2() { } }

value: 2

void Method() { void LocalFunction1() { } void LocalFunction2() { } }

Before statements with control transfer

Property names:

[resharper_]csharp_blank_lines_before_control_transfer_statements, [resharper_]blank_lines_before_control_transfer_statements

Possible values:

an integer

Examples:

value: 0

void Foo(string arg) { Logger.Log("Foo"); if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

value: 1

void Foo(string arg) { Logger.Log("Foo"); if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

value: 2

void Foo(string arg) { Logger.Log("Foo"); if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

After statements with control transfer

Property names:

[resharper_]csharp_blank_lines_after_control_transfer_statements, [resharper_]blank_lines_after_control_transfer_statements

Possible values:

an integer

Examples:

value: 0

void Foo(string arg) { if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

value: 1

void Foo(string arg) { if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

value: 2

void Foo(string arg) { if (arg == null) throw new ArgumentNullException(); var smth = arg.GetSomething(); if (smth == null) return null; var smthElse = smth.GetSomethingElse(); }

Before statements with child blocks

Property names:

[resharper_]csharp_blank_lines_before_block_statements, [resharper_]blank_lines_before_block_statements

Possible values:

an integer

Examples:

value: 0

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

value: 1

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

value: 2

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

After statements with child blocks

Property names:

[resharper_]csharp_blank_lines_after_block_statements, [resharper_]blank_lines_after_block_statements

Possible values:

an integer

Examples:

value: 0

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

value: 1

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

value: 2

string Foo(string arg) { Logger.Log("Foo"); if (arg == "A") { DoSomething(); DoSomethingElse(); } DoMoreThings(); }

Before multiline statements

Property names:

[resharper_]csharp_blank_lines_before_multiline_statements, [resharper_]blank_lines_before_multiline_statements

Possible values:

an integer

Examples:

value: 0

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

value: 1

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

value: 2

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

After multiline statements

Property names:

[resharper_]csharp_blank_lines_after_multiline_statements, [resharper_]blank_lines_after_multiline_statements

Possible values:

an integer

Examples:

value: 0

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

value: 1

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

value: 2

string Foo(string arg) { DoSomething(); foreach (var x in y) { x.DoSomething(); x.DoSomethingElse(); } DoSomething(); foreach (var x in y) x.DoSomething(); DoSomething(); DoSomething( 1, 2); DoSomething(); }

Around 'case' section with a block in switch statement

Property names:

[resharper_]csharp_blank_lines_around_block_case_section, [resharper_]blank_lines_around_block_case_section

Possible values:

an integer

Examples:

value: 0

switch (a) { case 1: { DoThis(); DoThat(); break; } case 2: { DoIt(); DoItAgainWithLove(); break; } default: { DoNothing(); DoSomething(); break; } }

value: 1

switch (a) { case 1: { DoThis(); DoThat(); break; } case 2: { DoIt(); DoItAgainWithLove(); break; } default: { DoNothing(); DoSomething(); break; } }

value: 2

switch (a) { case 1: { DoThis(); DoThat(); break; } case 2: { DoIt(); DoItAgainWithLove(); break; } default: { DoNothing(); DoSomething(); break; } }

Around multiline 'case' section in switch statement

Property names:

[resharper_]csharp_blank_lines_around_multiline_case_section, [resharper_]blank_lines_around_multiline_case_section

Possible values:

an integer

Examples:

value: 0

switch (a) { case 1: DoThis(); break; case 2: DoThat(); break; default: DoNothing(); break; }

value: 1

switch (a) { case 1: DoThis(); break; case 2: DoThat(); break; default: DoNothing(); break; }

value: 2

switch (a) { case 1: DoThis(); break; case 2: DoThat(); break; default: DoNothing(); break; }

Before 'case' in switch statement

Property names:

[resharper_]csharp_blank_lines_before_case, [resharper_]blank_lines_before_case

Possible values:

an integer

Examples:

value: 0

switch (a) { case 1: return x; case 2: return y; default: return 0; }

value: 1

switch (a) { case 1: return x; case 2: return y; default: return 0; }

value: 2

switch (a) { case 1: return x; case 2: return y; default: return 0; }

After 'case' in switch statement

Property names:

[resharper_]csharp_blank_lines_after_case, [resharper_]blank_lines_after_case

Possible values:

an integer

Examples:

value: 0

switch (a) { case 1: DoThis(); DoThat(); break; case 2: DoIt(); DoItAgainWithLove(); break; default: DoNothing(); DoSomething(); break; }

value: 1

switch (a) { case 1: DoThis(); DoThat(); break; case 2: DoIt(); DoItAgainWithLove(); break; default: DoNothing(); DoSomething(); break; }

value: 2

switch (a) { case 1: DoThis(); DoThat(); break; case 2: DoIt(); DoItAgainWithLove(); break; default: DoNothing(); DoSomething(); break; }
Last modified: 26 May 2024