ReSharper 2025.3 ヘルプ

C# の EditorConfig プロパティ: 空白行

このページでは、C# でフォーマット設定を構成するために使用できるカスタム ReSharper EditorConfig プロパティを一覧表示します。具体的には、ReSharper が名前空間、メンバー、リージョン、インポートディレクティブのグループの周囲の空白行の数を増やすか減らすかを指定します。

一般

領域の周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_region , [resharper_]blank_lines_around_region

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

領域の内側

プロパティ名:

[resharper_]csharp_blank_lines_inside_region , [resharper_]blank_lines_inside_region

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

1 行コメントの前

プロパティ名:

[resharper_]csharp_blank_lines_before_single_line_comment , [resharper_]blank_lines_before_single_line_comment

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

宣言の空白行

最大の空白行を宣言で保持する

プロパティ名:

[resharper_]csharp_keep_blank_lines_in_declarations , [resharper_]keep_blank_lines_in_declarations

使用可能な値:

整数

例:

フォーマット前

フォーマット後 value: 0

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

フォーマット前

フォーマット後 value: 1

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

フォーマット前

フォーマット後 value: 2

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

宣言の '{' の後と '}' の前の空白行を削除する

プロパティ名:

[resharper_]csharp_remove_blank_lines_near_braces_in_declarations , [resharper_]remove_blank_lines_near_braces_in_declarations

使用可能な値:

true | false

例:

フォーマット前

フォーマット後 true

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

フォーマット前

フォーマット後 false

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

ファイルヘッダーコメントの後

プロパティ名:

[resharper_]csharp_blank_lines_after_start_comment , [resharper_]blank_lines_after_start_comment

使用可能な値:

整数

例:

値: 0

// Header text class A { }

値: 1

// Header text class A { }

値: 2

// Header text class A { }

異なる 'using' グループ間

プロパティ名:

[resharper_]csharp_blank_lines_between_using_groups , [resharper_]blank_lines_between_using_groups

使用可能な値:

整数

例:

値: 0

using System; using System.Collections; using myNamespace;

値: 1

using System; using System.Collections; using myNamespace;

値: 2

using System; using System.Collections; using myNamespace;

'using' リストの後

プロパティ名:

[resharper_]csharp_blank_lines_after_using_list , [resharper_]blank_lines_after_using_list

使用可能な値:

整数

例:

値: 0

using System; namespace N { }

値: 1

using System; namespace N { }

値: 2

using System; namespace N { }

名前空間の周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_namespace , [resharper_]blank_lines_around_namespace

使用可能な値:

整数

例:

値: 0

namespace N1 { } namespace N2 { }

値: 1

namespace N1 { } namespace N2 { }

値: 2

namespace N1 { } namespace N2 { }

名前空間の内部

プロパティ名:

[resharper_]csharp_blank_lines_inside_namespace , [resharper_]blank_lines_inside_namespace

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

ファイルスコープの名前空間ディレクティブの後

プロパティ名:

[resharper_]csharp_blank_lines_after_file_scoped_namespace_directive , [resharper_]blank_lines_after_file_scoped_namespace_directive

使用可能な値:

整数

例:

値: 0

namespace N1; class C1 { } class C2 { }

値: 1

namespace N1; class C1 { } class C2 { }

値: 2

namespace N1; class C1 { } class C2 { }

型の周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_type , [resharper_]blank_lines_around_type

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

単一行タイプ周辺

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_type , [resharper_]blank_lines_around_single_line_type

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

型の内側

プロパティ名:

[resharper_]csharp_blank_lines_inside_type , [resharper_]blank_lines_inside_type

使用可能な値:

整数

例:

値: 0

class C { int x; int y; }

値: 1

class C { int x; int y; }

値: 2

class C { int x; int y; }

フィールドの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_field , [resharper_]blank_lines_around_field

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

一行辺りのフィールド

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_field , [resharper_]blank_lines_around_single_line_field

使用可能な値:

整数

例:

値: 0

class C { int x; int y; }

値: 1

class C { int x; int y; }

値: 2

class C { int x; int y; }

プロパティ / イベント周辺

プロパティ名:

[resharper_]csharp_blank_lines_around_property , [resharper_]blank_lines_around_property

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

単一行プロパティ / イベントの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_property , [resharper_]blank_lines_around_single_line_property

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

自動 / 抽象プロパティ / イベントの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_auto_property , [resharper_]blank_lines_around_auto_property

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

一行自動 / 抽象プロパティ / イベントの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_auto_property , [resharper_]blank_lines_around_single_line_auto_property

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

プロパティ / イベントアクセサー周辺

プロパティ名:

[resharper_]csharp_blank_lines_around_accessor , [resharper_]blank_lines_around_accessor

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

単一行のプロパティ / イベントアクセサー周辺

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_accessor , [resharper_]blank_lines_around_single_line_accessor

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

メソッドの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_invocable , [resharper_]blank_lines_around_invocable

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

単一行メソッドの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_invocable , [resharper_]blank_lines_around_single_line_invocable

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

コード内の空白行

最大の空白行をコード内に保持する

プロパティ名:

[resharper_]csharp_keep_blank_lines_in_code , [resharper_]keep_blank_lines_in_code

使用可能な値:

整数

例:

フォーマット前

フォーマット後 value: 0

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

フォーマット前

フォーマット後 value: 1

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

フォーマット前

フォーマット後 value: 2

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

コードの '{' の後と '}' の前の空白行を削除する

プロパティ名:

[resharper_]csharp_remove_blank_lines_near_braces_in_code , [resharper_]remove_blank_lines_near_braces_in_code

使用可能な値:

true | false

例:

フォーマット前

フォーマット後 true

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

フォーマット前

フォーマット後 false

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

ローカル関数の周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_local_method , [resharper_]blank_lines_around_local_method

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

単一行ローカル関数の周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_single_line_local_method , [resharper_]blank_lines_around_single_line_local_method

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

制御転送を伴う文の前

プロパティ名:

[resharper_]csharp_blank_lines_before_control_transfer_statements , [resharper_]blank_lines_before_control_transfer_statements

使用可能な値:

整数

例:

値: 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(); }

値: 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(); }

値: 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(); }

コントロール転送の後のステートメント

プロパティ名:

[resharper_]csharp_blank_lines_after_control_transfer_statements , [resharper_]blank_lines_after_control_transfer_statements

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

子ブロックを含む文の前

プロパティ名:

[resharper_]csharp_blank_lines_before_block_statements , [resharper_]blank_lines_before_block_statements

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

子ブロックを含む文

プロパティ名:

[resharper_]csharp_blank_lines_after_block_statements , [resharper_]blank_lines_after_block_statements

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

複数行の文の前

プロパティ名:

[resharper_]csharp_blank_lines_before_multiline_statements , [resharper_]blank_lines_before_multiline_statements

使用可能な値:

整数

例:

値: 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(); }

値: 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(); }

値: 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(); }

複数行のステートメントの後

プロパティ名:

[resharper_]csharp_blank_lines_after_multiline_statements , [resharper_]blank_lines_after_multiline_statements

使用可能な値:

整数

例:

値: 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(); }

値: 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(); }

値: 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(); }

switch ステートメントにブロックがある 'case' セクションの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_block_case_section , [resharper_]blank_lines_around_block_case_section

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

switch ステートメントの複数行 'case' セクションの周囲

プロパティ名:

[resharper_]csharp_blank_lines_around_multiline_case_section , [resharper_]blank_lines_around_multiline_case_section

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

switch ステートメントの 'case' の前

プロパティ名:

[resharper_]csharp_blank_lines_before_case , [resharper_]blank_lines_before_case

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

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

switch ステートメントの 'case' の後

プロパティ名:

[resharper_]csharp_blank_lines_after_case , [resharper_]blank_lines_after_case

使用可能な値:

整数

例:

値: 0

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

値: 1

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

値: 2

switch (a) { case 1: DoThis(); DoThat(); break; case 2: DoIt(); DoItAgainWithLove(); break; default: DoNothing(); DoSomething(); break; }
2024 年 5 月 26 日