C# の EditorConfig プロパティ: 改行
このページでは、C# でフォーマット設定を構成するために使用できるカスタム ReSharper EditorConfig プロパティをリストします。具体的には、ReSharper が特定の言語構造の前後に改行を追加または削除する方法と、次でハードラップ設定で指定された長さを超える長い行を折り返すかどうかです。
一般
既存の改行を維持する
プロパティ名:
[resharper_]csharp_keep_user_linebreaks、[resharper_]csharp_keep_existing_arrangement、[resharper_]csharp_keep_existing_linebreaks、[resharper_]keep_user_linebreaks、[resharper_]keep_existing_arrangement、[resharper_]keep_existing_linebreaks
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
int var = condition
? SomeFunc1()
: SomeFunc2(); | int var = condition
? SomeFunc1()
: SomeFunc2(); |
フォーマット前 | フォーマット後 false |
|---|---|
int var = condition
? SomeFunc1()
: SomeFunc2(); | int var = condition ? SomeFunc1() : SomeFunc2(); |
次でハードラップ
プロパティ名:
max_line_length , [resharper_]csharp_max_line_length
使用可能な値:
整数
「,」の前に折り返すことを好む
プロパティ名:
[resharper_]csharp_wrap_before_comma , [resharper_]wrap_before_comma
使用可能な値:
true | false
例:
true |
|---|
CallMethod(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, arg7); |
false |
|---|
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7); |
「=」の前に折り返すことを好む
プロパティ名:
[resharper_]csharp_wrap_before_eq , [resharper_]wrap_before_eq
使用可能な値:
true | false
例:
true |
|---|
myObject.ImportantField
+= someRatherLongExpression; |
false |
|---|
myObject.ImportantField +=
someRatherLongExpression; |
'else if' を特別扱いする
プロパティ名:
[resharper_]csharp_special_else_if_treatment , [resharper_]special_else_if_treatment
使用可能な値:
true | false
例:
true |
|---|
if (condition)
{
foo();
}
else if (condition)
{
} |
false |
|---|
if (condition)
{
foo();
}
else
if (condition)
{
} |
ファイルの終わりに改行
プロパティ名:
insert_final_newline , [resharper_]csharp_insert_final_newline
使用可能な値:
true | false
例:
true |
|---|
class A
{
}
|
false |
|---|
class A
{
} |
属性の配置
属性セクションのリストを別の行に置きます
プロパティ名:
[resharper_]csharp_max_attribute_length_for_same_line , [resharper_]max_attribute_length_for_same_line
使用可能な値:
整数
既存のアトリビュートの配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_attribute_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_attribute_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
[Attribute]
class C {}
[Attribute] class C1 {}
| [Attribute]
class C { }
[Attribute] class C1 { } |
フォーマット前 | フォーマット後 false |
|---|---|
[Attribute]
class C {}
[Attribute] class C1 {}
| [Attribute]
class C { }
[Attribute]
class C1 { } |
同じ行にタイプ属性を配置する
プロパティ名:
[resharper_]csharp_place_type_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_type_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
[Attribute]
class C { }
[Attribute]
class C1
{
// comment
} |
しない |
|---|
[Attribute]
class C { }
[Attribute]
class C1
{
// comment
} |
if_owner_is_single_line |
|---|
[Attribute] class C { }
[Attribute]
class C1
{
// comment
} |
true |
|---|
[Attribute] class C { }
[Attribute] class C1
{
// comment
} |
常時 |
|---|
[Attribute] class C { }
[Attribute] class C1
{
// comment
} |
メソッド属性を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_method_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_method_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
interface I
{
[Attribute]
void foo();
}
class C
{
[Attribute]
void foo()
{
// comment
}
} |
しない |
|---|
interface I
{
[Attribute]
void foo();
}
class C
{
[Attribute]
void foo()
{
// comment
}
} |
if_owner_is_single_line |
|---|
interface I
{
[Attribute] void foo();
}
class C
{
[Attribute]
void foo()
{
// comment
}
} |
true |
|---|
interface I
{
[Attribute] void foo();
}
class C
{
[Attribute] void foo()
{
// comment
}
} |
常時 |
|---|
interface I
{
[Attribute] void foo();
}
class C
{
[Attribute] void foo()
{
// comment
}
} |
プロパティ / インデクサー / イベント属性を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_accessorholder_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_accessorholder_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
interface I
{
[Attribute]
int Property { get; }
}
class C
{
[Attribute]
int Property
{
get
{
// comment
return x;
}
}
} |
しない |
|---|
interface I
{
[Attribute]
int Property { get; }
}
class C
{
[Attribute]
int Property
{
get
{
// comment
return x;
}
}
} |
if_owner_is_single_line |
|---|
interface I
{
[Attribute] int Property { get; }
}
class C
{
[Attribute]
int Property
{
get
{
// comment
return x;
}
}
} |
true |
|---|
interface I
{
[Attribute] int Property { get; }
}
class C
{
[Attribute] int Property
{
get
{
// comment
return x;
}
}
} |
常時 |
|---|
interface I
{
[Attribute] int Property { get; }
}
class C
{
[Attribute] int Property
{
get
{
// comment
return x;
}
}
} |
同じ行にアクセサー属性を配置する
プロパティ名:
[resharper_]csharp_place_accessor_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_accessor_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
interface I
{
int Property
{
[Attribute]
get;
}
}
class C
{
int Property
{
[Attribute]
get { return x; }
[Attribute]
set
{
x = value;
NotifySomething();
}
}
} |
しない |
|---|
interface I
{
int Property
{
[Attribute]
get;
}
}
class C
{
int Property
{
[Attribute]
get { return x; }
[Attribute]
set
{
x = value;
NotifySomething();
}
}
} |
if_owner_is_single_line |
|---|
interface I
{
int Property { [Attribute] get; }
}
class C
{
int Property
{
[Attribute] get { return x; }
[Attribute]
set
{
x = value;
NotifySomething();
}
}
} |
true |
|---|
interface I
{
int Property { [Attribute] get; }
}
class C
{
int Property
{
[Attribute] get { return x; }
[Attribute] set
{
x = value;
NotifySomething();
}
}
} |
常時 |
|---|
interface I
{
int Property { [Attribute] get; }
}
class C
{
int Property
{
[Attribute] get { return x; }
[Attribute] set
{
x = value;
NotifySomething();
}
}
} |
フィールド属性を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_field_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_field_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
class C
{
[Attribute]
int x;
[Attribute]
MyObj y = // comment
new MyObj();
} |
しない |
|---|
class C
{
[Attribute]
int x;
[Attribute]
MyObj y = // comment
new MyObj();
} |
if_owner_is_single_line |
|---|
class C
{
[Attribute] int x;
[Attribute]
MyObj y = // comment
new MyObj();
} |
true |
|---|
class C
{
[Attribute] int x;
[Attribute] MyObj y = // comment
new MyObj();
} |
常時 |
|---|
class C
{
[Attribute] int x;
[Attribute] MyObj y = // comment
new MyObj();
} |
レコードフィールド属性を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_record_field_attribute_on_same_line、[resharper_]csharp_place_attribute_on_same_line、[resharper_]place_record_field_attribute_on_same_line、[resharper_]place_attribute_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
record MyRecord(
[Attribute]
int Field); |
しない |
|---|
record MyRecord(
[Attribute]
int Field); |
if_owner_is_single_line |
|---|
record MyRecord([Attribute] int Field); |
true |
|---|
record MyRecord([Attribute] int Field); |
常時 |
|---|
record MyRecord([Attribute] int Field); |
メソッドシグネチャーの配置
仮パラメーターをラップする
プロパティ名:
[resharper_]csharp_wrap_parameters_style , [resharper_]wrap_parameters_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
interface IA
{
void M(int p1, int p2);
void SomeMethod(int p1,
int p2, int p3,
int p4);
} |
chop_if_long |
|---|
interface IA
{
void M(int p1, int p2);
void SomeMethod(int p1,
int p2,
int p3,
int p4);
} |
chop_always |
|---|
interface IA
{
void M(int p1,
int p2);
void SomeMethod(int p1,
int p2,
int p3,
int p4);
} |
1 行の最大正式パラメーター
プロパティ名:
[resharper_]csharp_max_formal_parameters_on_line , [resharper_]max_formal_parameters_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
interface IA
{
void M(int arg1);
void M(int arg1,
int arg2);
void M(int arg1,
int arg2,
int arg3);
void M(int arg1,
int arg2,
int arg3,
int arg4);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8,
int arg9);
} |
値: 1 |
|---|
interface IA
{
void M(int arg1);
void M(int arg1,
int arg2);
void M(int arg1,
int arg2,
int arg3);
void M(int arg1,
int arg2,
int arg3,
int arg4);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8);
void M(int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8,
int arg9);
} |
値: 2 |
|---|
interface IA
{
void M(int arg1);
void M(int arg1, int arg2);
void M(int arg1, int arg2,
int arg3);
void M(int arg1, int arg2,
int arg3, int arg4);
void M(int arg1, int arg2,
int arg3, int arg4,
int arg5);
void M(int arg1, int arg2,
int arg3, int arg4,
int arg5, int arg6);
void M(int arg1, int arg2,
int arg3, int arg4,
int arg5, int arg6,
int arg7);
void M(int arg1, int arg2,
int arg3, int arg4,
int arg5, int arg6,
int arg7, int arg8);
void M(int arg1, int arg2,
int arg3, int arg4,
int arg5, int arg6,
int arg7, int arg8,
int arg9);
} |
宣言に括弧の既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_declaration_parens_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_declaration_parens_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
void SomeMethod
(
int p1, int p2,
int p3, int p4
) {} | void SomeMethod
(
int p1, int p2,
int p3, int p4
)
{
} |
フォーマット前 | フォーマット後 false |
|---|---|
void SomeMethod
(
int p1, int p2,
int p3, int p4
) {} | void SomeMethod(int p1, int p2,
int p3, int p4)
{
} |
宣言で「(」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_declaration_lpar , [resharper_]wrap_before_declaration_lpar
使用可能な値:
true | false
例:
true |
|---|
void SomeMethod
(int p1, int p2,
int p3, int p4)
{
} |
false |
|---|
void SomeMethod(int p1, int p2,
int p3, int p4)
{
} |
宣言で「(」の後にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_after_declaration_lpar , [resharper_]wrap_after_declaration_lpar
使用可能な値:
true | false
例:
true |
|---|
void SomeMethod(
int p1, int p2,
int p3, int p4)
{
} |
false |
|---|
void SomeMethod(int p1, int p2,
int p3, int p4)
{
} |
宣言で「)」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_declaration_rpar , [resharper_]wrap_before_declaration_rpar
使用可能な値:
true | false
例:
true |
|---|
void SomeMethod(int p1, int p2,
int p3, int p4
)
{
} |
false |
|---|
void SomeMethod(int p1, int p2,
int p3, int p4)
{
} |
同じ行にコンストラクター初期化子を許可する
プロパティ名:
[resharper_]csharp_place_constructor_initializer_on_same_line , [resharper_]place_constructor_initializer_on_same_line
使用可能な値:
true | false
例:
true |
|---|
class C
{
public C() : base()
{
}
} |
false |
|---|
class C
{
public C()
: base()
{
}
} |
プライマリコンストラクターシグネチャーの配置
プライマリコンストラクターパラメーターをラップする
プロパティ名:
[resharper_]csharp_wrap_primary_constructor_parameters_style , [resharper_]wrap_primary_constructor_parameters_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name, IParametersOwner owner, int parameterIndex,
ParameterKind kind, ScopedKind parameterScope,
IType type) : IParameter; |
chop_if_long |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
chop_always |
|---|
public record Person(
string Name,
int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
単一行でのプライマリコンストラクターパラメーターの最大数
プロパティ名:
[resharper_]csharp_max_primary_constructor_parameters_on_line , [resharper_]max_primary_constructor_parameters_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
public record Person(
string Name,
int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
値: 1 |
|---|
public record Person(
string Name,
int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
値: 2 |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
宣言に括弧の既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_primary_constructor_declaration_parens_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_primary_constructor_declaration_parens_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type
) : IParameter; | public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type
) : IParameter; |
フォーマット前 | フォーマット後 false |
|---|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type
) : IParameter; | public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
宣言で「(」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_primary_constructor_declaration_lpar , [resharper_]wrap_before_primary_constructor_declaration_lpar
使用可能な値:
true | false
例:
true |
|---|
public record Person(string Name, int Age);
public partial class Parameter
(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
false |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
宣言で「(」の後にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_after_primary_constructor_declaration_lpar , [resharper_]wrap_after_primary_constructor_declaration_lpar
使用可能な値:
true | false
例:
true |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
false |
|---|
public record Person(string Name, int Age);
public partial class Parameter(string name,
IParametersOwner owner,
int parameterIndex,
ParameterKind kind,
ScopedKind parameterScope,
IType type) : IParameter; |
宣言で「)」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_primary_constructor_declaration_rpar , [resharper_]wrap_before_primary_constructor_declaration_rpar
使用可能な値:
true | false
例:
true |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
int parameterIndex,
ParameterKind kind,
IType type
) : IParameter; |
false |
|---|
public record Person(string Name, int Age);
public partial class Parameter(
string name,
int parameterIndex,
ParameterKind kind,
IType type) : IParameter; |
表現ボディメンバーの配置
表現体のメンバーの既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_expr_member_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_expr_member_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
class A
{
public int Foo() => 0;
public int Foo1()
=> 1;
public int Foo2() =>
2;
} | class A
{
public int Foo() => 0;
public int Foo1()
=> 1;
public int Foo2() =>
2;
} |
フォーマット前 | フォーマット後 false |
|---|---|
class A
{
public int Foo() => 0;
public int Foo1()
=> 1;
public int Foo2() =>
2;
} | class A
{
public int Foo() => 0;
public int Foo1() => 1;
public int Foo2() => 2;
} |
メソッド式本体を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_expr_method_on_single_line , [resharper_]place_expr_method_on_single_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
class A
{
public int Foo() =>
0;
public int // comment
Foo1() =>
1;
public int Foo2() =>
1 + // comment
2;
} |
しない |
|---|
class A
{
public int Foo() =>
0;
public int // comment
Foo1() =>
1;
public int Foo2() =>
1 + // comment
2;
} |
if_owner_is_single_line |
|---|
class A
{
public int Foo() => 0;
public int // comment
Foo1() =>
1;
public int Foo2() =>
1 + // comment
2;
} |
true |
|---|
class A
{
public int Foo() => 0;
public int // comment
Foo1() => 1;
public int Foo2() => 1 + // comment
2;
} |
常時 |
|---|
class A
{
public int Foo() => 0;
public int // comment
Foo1() => 1;
public int Foo2() => 1 + // comment
2;
} |
プロパティ式本体を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_expr_property_on_single_line , [resharper_]place_expr_property_on_single_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
class A
{
public int Foo =>
0;
public int // comment
Foo1 =>
1;
public int Foo2 =>
1 + // comment
2;
} |
しない |
|---|
class A
{
public int Foo =>
0;
public int // comment
Foo1 =>
1;
public int Foo2 =>
1 + // comment
2;
} |
if_owner_is_single_line |
|---|
class A
{
public int Foo => 0;
public int // comment
Foo1 =>
1;
public int Foo2 =>
1 + // comment
2;
} |
true |
|---|
class A
{
public int Foo => 0;
public int // comment
Foo1 => 1;
public int Foo2 => 1 + // comment
2;
} |
常時 |
|---|
class A
{
public int Foo => 0;
public int // comment
Foo1 => 1;
public int Foo2 => 1 + // comment
2;
} |
プロパティアクセサー式本体を同じ行に配置する
プロパティ名:
[resharper_]csharp_place_expr_accessor_on_single_line , [resharper_]place_expr_accessor_on_single_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
class A
{
public int Foo
{
get =>
0;
}
public int Foo1
{
get =>
1 + // comment
2;
}
} |
しない |
|---|
class A
{
public int Foo
{
get =>
0;
}
public int Foo1
{
get =>
1 + // comment
2;
}
} |
if_owner_is_single_line |
|---|
class A
{
public int Foo
{
get => 0;
}
public int Foo1
{
get =>
1 + // comment
2;
}
} |
true |
|---|
class A
{
public int Foo
{
get => 0;
}
public int Foo1
{
get => 1 + // comment
2;
}
} |
常時 |
|---|
class A
{
public int Foo
{
get => 0;
}
public int Foo1
{
get => 1 + // comment
2;
}
} |
式が続く「=>」の前に折り返すことを好む
プロパティ名:
[resharper_]csharp_wrap_before_arrow_with_expressions , [resharper_]wrap_before_arrow_with_expressions
使用可能な値:
true | false
例:
true |
|---|
class A
{
public int Foo(int y)
=> Br(y * y + y <<
y + y);
Func<int, int, int>
Method2()
{
return (xxx, yyy)
=> Br(xxx * yyy);
}
} |
false |
|---|
class A
{
public int Foo(int y) =>
Br(y * y + y << y + y);
Func<int, int, int>
Method2()
{
return (xxx, yyy) =>
Br(xxx * yyy);
}
} |
型パラメーター、制約、基本型の配置
同じ行に型制約を許可する
プロパティ名:
[resharper_]csharp_place_type_constraints_on_same_line , [resharper_]place_type_constraints_on_same_line
使用可能な値:
true | false
例:
true |
|---|
class C<T> where T : IEnumerable
{
} |
false |
|---|
class C<T>
where T : IEnumerable
{
} |
最初の制約の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_first_type_parameter_constraint , [resharper_]wrap_before_first_type_parameter_constraint
使用可能な値:
true | false
例:
true |
|---|
class C<T1, T2, T3>
where T1 : I1
where T2 : new()
where T3 : class |
false |
|---|
class C<T1, T2, T3> where T1 : I1
where T2 : new()
where T3 : class |
複数の型パラメーターの制約をラップする
プロパティ名:
[resharper_]csharp_wrap_multiple_type_parameter_constraints_style , [resharper_]wrap_multiple_type_parameter_constraints_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
class C<T1, T2, T3> where T1 : I1 where T2 : new()
where T3 : class |
chop_if_long |
|---|
class C<T1, T2, T3> where T1 : I1
where T2 : new()
where T3 : class |
chop_always |
|---|
class C<T1, T2, T3> where T1 : I1
where T2 : new()
where T3 : class |
型パラメーターリストで山括弧括弧を開く前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_type_parameter_langle , [resharper_]wrap_before_type_parameter_langle
使用可能な値:
true | false
例:
true |
|---|
class C
<Type1, Type2,
Type3, Type4>
{
} |
false |
|---|
class C<Type1, Type2,
Type3, Type4>
{
} |
「:」の前に折り返すことを好む
プロパティ名:
[resharper_]csharp_wrap_before_extends_colon , [resharper_]wrap_before_extends_colon
使用可能な値:
true | false
例:
true |
|---|
class Derived
: BaseClass, I1, I2,
I3, I4
{
} |
false |
|---|
class Derived : BaseClass, I1,
I2,
I3, I4
{
} |
ラップ拡張 / リストの実装
プロパティ名:
[resharper_]csharp_wrap_extends_list_style , [resharper_]wrap_extends_list_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
class Derived : BaseClass, I1,
I2, I3, I4
{
} |
chop_if_long |
|---|
class Derived : BaseClass,
I1,
I2,
I3,
I4
{
} |
chop_always |
|---|
class Derived : BaseClass,
I1,
I2,
I3,
I4
{
} |
宣言ブロックの配置
宣言ブロックの既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_declaration_block_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_declaration_block_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
interface I{
int Property {
get; set;
}
}
interface I{int Property{get;set;}}
| interface I
{
int Property
{
get;
set;
}
}
interface I
{
int Property { get; set; }
} |
フォーマット前 | フォーマット後 false |
|---|---|
interface I{
int Property {
get; set;
}
}
interface I{int Property{get;set;}}
| interface I
{
int Property { get; set; }
}
interface I
{
int Property { get; set; }
} |
抽象 / 自動プロパティ / インデクサ / イベント宣言を 1 行に配置
プロパティ名:
[resharper_]csharp_place_abstract_accessorholder_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_abstract_accessorholder_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
interface I
{
int Property { get; set; }
} |
false |
|---|
interface I
{
int Property
{
get;
set;
}
} |
単純なプロパティ / インデクサ / イベント宣言を 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_accessorholder_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_simple_accessorholder_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
class C
{
int Property { get { return x; } set { x = value; } }
} |
false |
|---|
class C
{
int Property
{
get { return x; }
set { x = value; }
}
} |
アクセサー上に属性がある場合でも 1 行に配置する
プロパティ名:
[resharper_]csharp_place_accessor_with_attrs_holder_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_accessor_with_attrs_holder_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
class C
{
int Property
{
[Attr] get { return x; }
[Attr] set { x = value; }
}
} |
false |
|---|
class C
{
int Property
{
[Attr] get { return x; }
[Attr] set { x = value; }
}
} |
シンプルなアクセサーを 1 行に配置
プロパティ名:
[resharper_]csharp_place_simple_accessor_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_simple_accessor_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
class C
{
int Property
{
get { return x; }
set
{
if (value == null) throw new Exception();
}
}
} |
false |
|---|
class C
{
int Property
{
get
{
return x;
}
set
{
if (value == null) throw new Exception();
}
}
} |
単純なメソッドを 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_method_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_simple_method_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
class C
{
void Foo() { DoSomethingSimple(); }
} |
false |
|---|
class C
{
void Foo()
{
DoSomethingSimple();
}
} |
列挙の配置
列挙の既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_enum_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_enum_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
public enum Enum1 { a, b, c }
public enum Enum2 {
a,
b,
c
}
public enum Enum3 {
a, b,
c, d
} | public enum Enum1 { a, b, c }
public enum Enum2
{
a,
b,
c
}
public enum Enum3
{
a, b,
c, d
} |
フォーマット前 | フォーマット後 false |
|---|---|
public enum Enum1 { a, b, c }
public enum Enum2 {
a,
b,
c
}
public enum Enum3 {
a, b,
c, d
} | public enum Enum1
{
a,
b,
c
}
public enum Enum2
{
a,
b,
c
}
public enum Enum3
{
a,
b,
c,
d
} |
1 行の最大列挙メンバー
プロパティ名:
[resharper_]csharp_max_enum_members_on_line , [resharper_]max_enum_members_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
public enum Enum1
{
val1
}
public enum Enum2
{
val1,
val2
}
public enum Enum3
{
val1,
val2,
val3
}
public enum Enum4
{
val1,
val2,
val3,
val4
}
public enum Enum5
{
val1,
val2,
val3,
val4,
val5
}
public enum Enum6
{
val1,
val2,
val3,
val4,
val5,
val6
}
public enum Enum7
{
val1,
val2,
val3,
val4,
val5,
val6,
val7
}
public enum Enum8
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8
}
public enum Enum9
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8,
val9
} |
値: 1 |
|---|
public enum Enum1
{
val1
}
public enum Enum2
{
val1,
val2
}
public enum Enum3
{
val1,
val2,
val3
}
public enum Enum4
{
val1,
val2,
val3,
val4
}
public enum Enum5
{
val1,
val2,
val3,
val4,
val5
}
public enum Enum6
{
val1,
val2,
val3,
val4,
val5,
val6
}
public enum Enum7
{
val1,
val2,
val3,
val4,
val5,
val6,
val7
}
public enum Enum8
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8
}
public enum Enum9
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8,
val9
} |
値: 2 |
|---|
public enum Enum1
{
val1
}
public enum Enum2
{
val1, val2
}
public enum Enum3
{
val1, val2,
val3
}
public enum Enum4
{
val1, val2,
val3, val4
}
public enum Enum5
{
val1, val2,
val3, val4,
val5
}
public enum Enum6
{
val1, val2,
val3, val4,
val5, val6
}
public enum Enum7
{
val1, val2,
val3, val4,
val5, val6,
val7
}
public enum Enum8
{
val1, val2,
val3, val4,
val5, val6,
val7, val8
}
public enum Enum9
{
val1, val2,
val3, val4,
val5, val6,
val7, val8,
val9
} |
単純な列挙を 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_enum_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]csharp_place_simple_declaration_blocks_on_single_line、[resharper_]place_simple_enum_on_single_line、[resharper_]place_simple_blocks_on_single_line、[resharper_]place_simple_declaration_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
public enum Enum1 { a, b, c } |
false |
|---|
public enum Enum1
{
a, b, c
} |
列挙宣言を折り返す
プロパティ名:
[resharper_]csharp_wrap_enum_declaration , [resharper_]wrap_enum_declaration
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
public enum Enum1
{
a, b, c
}
public enum Enum2
{
aaaaa, bbbbb, ccccc,
ddddd, eeeee, fffff
} |
chop_if_long |
|---|
public enum Enum1
{
a, b, c
}
public enum Enum2
{
aaaaa,
bbbbb,
ccccc,
ddddd,
eeeee,
fffff
} |
chop_always |
|---|
public enum Enum1
{
a,
b,
c
}
public enum Enum2
{
aaaaa,
bbbbb,
ccccc,
ddddd,
eeeee,
fffff
} |
ステートメントの配置
「else」を新しい行に配置する
プロパティ名:
csharp_new_line_before_else , [resharper_]new_line_before_else
使用可能な値:
true | false
例:
true |
|---|
if (condition)
{
foo();
}
else
{
foo();
} |
false |
|---|
if (condition)
{
foo();
} else
{
foo();
} |
'while' を新しい行に配置する
プロパティ名:
[resharper_]csharp_new_line_before_while , [resharper_]new_line_before_while
使用可能な値:
true | false
例:
true |
|---|
do
{
foo();
}
while (condition); |
false |
|---|
do
{
foo();
} while (condition); |
'catch' を新しい行に配置する
プロパティ名:
csharp_new_line_before_catch , [resharper_]new_line_before_catch
使用可能な値:
true | false
例:
true |
|---|
try
{
foo();
}
catch (Exception e)
{
foo();
}
finally
{
foo();
} |
false |
|---|
try
{
foo();
} catch (Exception e)
{
foo();
}
finally
{
foo();
} |
'finally' を改行する
プロパティ名:
csharp_new_line_before_finally , [resharper_]new_line_before_finally
使用可能な値:
true | false
例:
true |
|---|
try
{
foo();
}
catch (Exception e)
{
foo();
}
finally
{
foo();
} |
false |
|---|
try
{
foo();
}
catch (Exception e)
{
foo();
} finally
{
foo();
} |
'for' ステートメントヘッダーをラップする
プロパティ名:
[resharper_]csharp_wrap_for_stmt_header_style , [resharper_]wrap_for_stmt_header_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
for (int i = initial;
i < loopLimit; i++)
{
} |
chop_if_long |
|---|
for (int i = initial;
i < loopLimit;
i++)
{
} |
chop_always |
|---|
for (int i = initial;
i < loopLimit;
i++)
{
} |
複数の宣言をラップする
プロパティ名:
[resharper_]csharp_wrap_multiple_declaration_style , [resharper_]wrap_multiple_declaration_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
class C
{
public int i = 0, j = 0,
k = 2, l = 3, m = 4,
n = 5;
} |
chop_if_long |
|---|
class C
{
public int i = 0,
j = 0,
k = 2,
l = 3,
m = 4,
n = 5;
} |
chop_always |
|---|
class C
{
public int i = 0,
j = 0,
k = 2,
l = 3,
m = 4,
n = 5;
} |
埋め込まれたステートメントの配置
既存の埋込み文の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_embedded_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_embedded_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
{
if (condition) DoSomething();
if (condition1)
DoSomething1();
} | {
if (condition) DoSomething();
if (condition1)
DoSomething1();
} |
フォーマット前 | フォーマット後 false |
|---|---|
{
if (condition) DoSomething();
if (condition1)
DoSomething1();
} | {
if (condition) DoSomething();
if (condition1) DoSomething1();
} |
単純な埋め込みステートメントを同じ行に配置する
プロパティ名:
[resharper_]csharp_place_simple_embedded_statement_on_same_line , [resharper_]place_simple_embedded_statement_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
{
if (condition)
DoSomething();
if (condition && // comment
condition1)
DoSomething();
} |
しない |
|---|
{
if (condition)
DoSomething();
if (condition && // comment
condition1)
DoSomething();
} |
if_owner_is_single_line |
|---|
{
if (condition) DoSomething();
if (condition && // comment
condition1)
DoSomething();
} |
true |
|---|
{
if (condition) DoSomething();
if (condition && // comment
condition1) DoSomething();
} |
常時 |
|---|
{
if (condition) DoSomething();
if (condition && // comment
condition1) DoSomething();
} |
単純な 'case' ステートメントを同じ行に置く
プロパティ名:
[resharper_]csharp_place_simple_case_statement_on_same_line , [resharper_]place_simple_case_statement_on_same_line
使用可能な値:
false: なしnever: なしif_owner_is_single_line: 所有者がシングルラインの場合true: 常時always: 常時
例:
false |
|---|
switch (foo)
{
case 1:
return a;
case 2:
case 3:
return a;
} |
しない |
|---|
switch (foo)
{
case 1:
return a;
case 2:
case 3:
return a;
} |
if_owner_is_single_line |
|---|
switch (foo)
{
case 1: return a;
case 2:
case 3:
return a;
} |
true |
|---|
switch (foo)
{
case 1: return a;
case 2:
case 3: return a;
} |
常時 |
|---|
switch (foo)
{
case 1: return a;
case 2:
case 3: return a;
} |
埋め込まれたブロックの配置
埋め込みブロックの既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_embedded_block_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_embedded_block_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
{
if (condition) { DoSomething(); }
if (condition1)
{
DoSomething1();
}
} | {
if (condition) { DoSomething(); }
if (condition1)
{
DoSomething1();
}
} |
フォーマット前 | フォーマット後 false |
|---|---|
{
if (condition) { DoSomething(); }
if (condition1)
{
DoSomething1();
}
} | {
if (condition)
{
DoSomething();
}
if (condition1)
{
DoSomething1();
}
} |
同じ行に 1 つの単純なステートメントでブロックを配置する
プロパティ名:
[resharper_]csharp_place_simple_embedded_block_on_same_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]place_simple_embedded_block_on_same_line、[resharper_]place_simple_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
if (condition) { DoSomething(); } |
false |
|---|
if (condition)
{
DoSomething();
} |
単純な匿名メソッドを 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_anonymousmethod_on_single_line、[resharper_]csharp_place_simple_blocks_on_single_line、[resharper_]place_simple_anonymousmethod_on_single_line、[resharper_]place_simple_blocks_on_single_line
使用可能な値:
true | false
例:
true |
|---|
EventHandler e = delegate { return; }; |
false |
|---|
EventHandler e = delegate
{
return;
}; |
switch 式の配置
switch 式の既存の配置を保持する
プロパティ名:
[resharper_]csharp_keep_existing_switch_expression_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_switch_expression_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
{
var result = x switch {
T.A => 0, T.B => 1
};
var result = x switch { T.A => 0, T.B => 1 };
} | {
var result = x switch
{
T.A => 0, T.B => 1
};
var result = x switch { T.A => 0, T.B => 1 };
} |
フォーマット前 | フォーマット後 false |
|---|---|
{
var result = x switch {
T.A => 0, T.B => 1
};
var result = x switch { T.A => 0, T.B => 1 };
} | {
var result = x switch
{
T.A => 0,
T.B => 1
};
var result = x switch
{
T.A => 0,
T.B => 1
};
} |
単一行に単純な switch 式を配置する
プロパティ名:
[resharper_]csharp_place_simple_switch_expression_on_single_line , [resharper_]place_simple_switch_expression_on_single_line
使用可能な値:
true | false
例:
true |
|---|
var result = x switch { T.A => 0, T.B => 1 }; |
false |
|---|
var result = x switch
{
T.A => 0, T.B => 1
}; |
ラップ switch 式
プロパティ名:
[resharper_]csharp_wrap_switch_expression , [resharper_]wrap_switch_expression
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
(x switch
{
T.A => 0, T.B => 1, T.C => 2
}) +
(x switch
{
T.A => 0, T.B => 1 +
2,
T.C => 2
}) |
chop_if_long |
|---|
(x switch
{
T.A => 0, T.B => 1, T.C => 2
}) +
(x switch
{
T.A => 0,
T.B => 1 +
2,
T.C => 2
}) |
chop_always |
|---|
(x switch
{
T.A => 0,
T.B => 1,
T.C => 2
}) +
(x switch
{
T.A => 0,
T.B => 1 +
2,
T.C => 2
}) |
プロパティパターンの配置
プロパティパターンの既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_property_patterns_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_property_patterns_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
bool matches = sourceObject is MyType {
F1: 1,
F2: 2
} &&
sourceObject is MyType { F1: 1, F2: 2 }; | bool matches = sourceObject is MyType
{
F1: 1,
F2: 2
} &&
sourceObject is MyType { F1: 1, F2: 2 }; |
フォーマット前 | フォーマット後 false |
|---|---|
bool matches = sourceObject is MyType {
F1: 1,
F2: 2
} &&
sourceObject is MyType { F1: 1, F2: 2 }; | bool matches = sourceObject is MyType { F1: 1, F2: 2 } &&
sourceObject is MyType { F1: 1, F2: 2 }; |
単純なプロパティパターンを 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_property_pattern_on_single_line , [resharper_]place_simple_property_pattern_on_single_line
使用可能な値:
true | false
例:
true |
|---|
bool matches = sourceObject is MyType { F1: 1, F2: 2 }; |
false |
|---|
bool matches = sourceObject is MyType
{
F1: 1, F2: 2
}; |
ラッププロパティパターン
プロパティ名:
[resharper_]csharp_wrap_property_pattern , [resharper_]wrap_property_pattern
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
bool matches =
sourceObject is MyType
{
F1: 1, F2: 2
} &&
sourceObject is MyType
{
F1: 1, F2: 2, F3: 3, F4: 4,
F5: 5, F6: 6, F7: 7, F8: 8
}; |
chop_if_long |
|---|
bool matches =
sourceObject is MyType
{
F1: 1, F2: 2
} &&
sourceObject is MyType
{
F1: 1,
F2: 2,
F3: 3,
F4: 4,
F5: 5,
F6: 6,
F7: 7,
F8: 8
}; |
chop_always |
|---|
bool matches = sourceObject is MyType
{
F1: 1,
F2: 2
} &&
sourceObject is MyType
{
F1: 1,
F2: 2,
F3: 3,
F4: 4,
F5: 5,
F6: 6,
F7: 7,
F8: 8
}; |
リストパターンの配置
リストパターンとコレクション式の既存の配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_list_patterns_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_list_patterns_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
true |
|---|
int[] collection =
[
1,
2,
3,
4,
5,
6
];
var otherCollection = [1, 2, 3, 4, 5, 6];
var matches = collection is
[
1,
> 0,
not 42,
4,
5,
6
];
var otherMatches = otherCollection is [1, 2, 3, 4, 5, 6]; |
false |
|---|
int[] collection = [1, 2, 3, 4, 5, 6];
var otherCollection = [1, 2, 3, 4, 5, 6];
var matches = collection is [1, > 0, not 42, 4, 5, 6];
var otherMatches = otherCollection is [1, 2, 3, 4, 5, 6]; |
単純なリストパターンとコレクション式を 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_list_pattern_on_single_line , [resharper_]place_simple_list_pattern_on_single_line
使用可能な値:
true | false
例:
true |
|---|
int[] collection = [1, 2, 3, 4, 5, 6, 7, 8];
var matches = collection is [1, > 0, not 42, 4, 5, 6, 7, 8]; |
false |
|---|
int[] collection =
[
1, 2, 3, 4, 5, 6, 7, 8
];
var matches = collection is
[
1, > 0, not 42, 4, 5, 6, 7, 8
]; |
ラップリストパターンとコレクション式
プロパティ名:
[resharper_]csharp_wrap_list_pattern , [resharper_]wrap_list_pattern
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
int[] collection =
[
Element1, Element2, Element3,
Element4, Element5, Element6,
Element7
];
var matches = collection is
[
1, 2, > 0, 4, 5, 6, not 42, 8,
9, 10, 11, 12, 13
]; |
chop_if_long |
|---|
int[] collection =
[
Element1,
Element2,
Element3,
Element4,
Element5,
Element6,
Element7
];
var matches = collection is
[
1,
2,
> 0,
4,
5,
6,
not 42,
8,
9,
10,
11,
12,
13
]; |
chop_always |
|---|
int[] collection =
[
Element1,
Element2,
Element3,
Element4,
Element5,
Element6,
Element7
];
var matches = collection is
[
1,
2,
> 0,
4,
5,
6,
not 42,
8,
9,
10,
11,
12,
13
]; |
イニシャライザーの配置
既存のイニシャライザーの配置を維持する
プロパティ名:
[resharper_]csharp_keep_existing_initializer_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_initializer_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
{
var result = new {
A = 0
};
var result = new { A = 0 };
} | {
var result = new
{
A = 0
};
var result = new { A = 0 };
} |
フォーマット前 | フォーマット後 false |
|---|---|
{
var result = new {
A = 0
};
var result = new { A = 0 };
} | {
var result = new { A = 0 };
var result = new { A = 0 };
} |
単純な配列、オブジェクト、コレクションを 1 行に配置する
プロパティ名:
[resharper_]csharp_place_simple_initializer_on_single_line , [resharper_]place_simple_initializer_on_single_line
使用可能な値:
true | false
例:
true |
|---|
var result = new { A = 0 }; |
false |
|---|
var result = new
{
A = 0
}; |
単一行の最大オブジェクトおよびコレクション初期化子要素
プロパティ名:
[resharper_]csharp_max_initializer_elements_on_line , [resharper_]max_initializer_elements_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
{
x = new C() { Prop1 = 1 };
x = new C()
{
Prop1 = 1,
Prop2 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1,
Prop8 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1,
Prop8 = 1,
Prop9 = 1
};
} |
値: 1 |
|---|
{
x = new C() { Prop1 = 1 };
x = new C()
{
Prop1 = 1,
Prop2 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1,
Prop8 = 1
};
x = new C()
{
Prop1 = 1,
Prop2 = 1,
Prop3 = 1,
Prop4 = 1,
Prop5 = 1,
Prop6 = 1,
Prop7 = 1,
Prop8 = 1,
Prop9 = 1
};
} |
値: 2 |
|---|
{
x = new C() { Prop1 = 1 };
x = new C() { Prop1 = 1, Prop2 = 1 };
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1,
Prop5 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1,
Prop5 = 1, Prop6 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1,
Prop5 = 1, Prop6 = 1,
Prop7 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1,
Prop5 = 1, Prop6 = 1,
Prop7 = 1, Prop8 = 1
};
x = new C()
{
Prop1 = 1, Prop2 = 1,
Prop3 = 1, Prop4 = 1,
Prop5 = 1, Prop6 = 1,
Prop7 = 1, Prop8 = 1,
Prop9 = 1
};
} |
ラップオブジェクトとコレクションの初期化子
プロパティ名:
[resharper_]csharp_wrap_object_and_collection_initializer_style , [resharper_]wrap_object_and_collection_initializer_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
new C()
{
PropertyX = 1, PropertyY = 2,
PropertyZ = 3
} |
chop_if_long |
|---|
new C()
{
PropertyX = 1,
PropertyY = 2,
PropertyZ = 3
} |
chop_always |
|---|
new C()
{
PropertyX = 1,
PropertyY = 2,
PropertyZ = 3
} |
配列初期化子とコレクション式の要素を 1 行に最大数まで
プロパティ名:
[resharper_]csharp_max_array_initializer_elements_on_line , [resharper_]max_array_initializer_elements_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
{
x = new[] { val1 };
x = new[]
{
val1,
val2
};
x = new[]
{
val1,
val2,
val3
};
x = new[]
{
val1,
val2,
val3,
val4
};
x = new[]
{
val1,
val2,
val3,
val4,
val5
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8,
val9
};
} |
値: 1 |
|---|
{
x = new[] { val1 };
x = new[]
{
val1,
val2
};
x = new[]
{
val1,
val2,
val3
};
x = new[]
{
val1,
val2,
val3,
val4
};
x = new[]
{
val1,
val2,
val3,
val4,
val5
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8
};
x = new[]
{
val1,
val2,
val3,
val4,
val5,
val6,
val7,
val8,
val9
};
} |
値: 2 |
|---|
{
x = new[] { val1 };
x = new[] { val1, val2 };
x = new[]
{
val1, val2,
val3
};
x = new[]
{
val1, val2,
val3, val4
};
x = new[]
{
val1, val2,
val3, val4,
val5
};
x = new[]
{
val1, val2,
val3, val4,
val5, val6
};
x = new[]
{
val1, val2,
val3, val4,
val5, val6,
val7
};
x = new[]
{
val1, val2,
val3, val4,
val5, val6,
val7, val8
};
x = new[]
{
val1, val2,
val3, val4,
val5, val6,
val7, val8,
val9
};
} |
ラップ配列初期化子
プロパティ名:
[resharper_]csharp_wrap_array_initializer_style , [resharper_]wrap_array_initializer_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
new C[]
{
Element1, ElementX, ElementY,
ElementZ, ElementZzz
} |
chop_if_long |
|---|
new C[]
{
Element1,
ElementX,
ElementY,
ElementZ,
ElementZzz
} |
chop_always |
|---|
new C[]
{
Element1,
ElementX,
ElementY,
ElementZ,
ElementZzz
} |
呼び出しの配置
呼び出し引数をラップする
プロパティ名:
[resharper_]csharp_wrap_arguments_style , [resharper_]wrap_arguments_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
{
CallMethod(arg1, arg2);
CallMethod(arg1, arg2,
arg3, arg4, arg5);
} |
chop_if_long |
|---|
{
CallMethod(arg1, arg2);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5);
} |
chop_always |
|---|
{
CallMethod(arg1,
arg2);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5);
} |
1 行の最大呼び出し引数
プロパティ名:
[resharper_]csharp_max_invocation_arguments_on_line , [resharper_]max_invocation_arguments_on_line
使用可能な値:
整数
例:
値: 0 |
|---|
{
CallMethod(arg1);
CallMethod(arg1,
arg2);
CallMethod(arg1,
arg2,
arg3);
CallMethod(arg1,
arg2,
arg3,
arg4);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9);
} |
値: 1 |
|---|
{
CallMethod(arg1);
CallMethod(arg1,
arg2);
CallMethod(arg1,
arg2,
arg3);
CallMethod(arg1,
arg2,
arg3,
arg4);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8);
CallMethod(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9);
} |
値: 2 |
|---|
{
CallMethod(arg1);
CallMethod(arg1, arg2);
CallMethod(arg1, arg2,
arg3);
CallMethod(arg1, arg2,
arg3, arg4);
CallMethod(arg1, arg2,
arg3, arg4,
arg5);
CallMethod(arg1, arg2,
arg3, arg4,
arg5, arg6);
CallMethod(arg1, arg2,
arg3, arg4,
arg5, arg6,
arg7);
CallMethod(arg1, arg2,
arg3, arg4,
arg5, arg6,
arg7, arg8);
CallMethod(arg1, arg2,
arg3, arg4,
arg5, arg6,
arg7, arg8,
arg9);
} |
既存の括弧の並びを呼び出しに保持
プロパティ名:
[resharper_]csharp_keep_existing_invocation_parens_arrangement、[resharper_]csharp_keep_existing_arrangement、[resharper_]keep_existing_invocation_parens_arrangement、[resharper_]keep_existing_arrangement
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
CallMethod
(
arg1, arg2,
arg3, arg4, arg5
); | CallMethod
(
arg1, arg2,
arg3, arg4, arg5
); |
フォーマット前 | フォーマット後 false |
|---|---|
CallMethod
(
arg1, arg2,
arg3, arg4, arg5
); | CallMethod(arg1, arg2,
arg3, arg4, arg5); |
呼び出しで「(」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_invocation_lpar , [resharper_]wrap_before_invocation_lpar
使用可能な値:
true | false
例:
true |
|---|
CallMethod
(arg1, arg2,
arg3, arg4, arg5); |
false |
|---|
CallMethod(arg1, arg2,
arg3, arg4, arg5); |
呼び出しで「(」の後にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_after_invocation_lpar , [resharper_]wrap_after_invocation_lpar
使用可能な値:
true | false
例:
true |
|---|
CallMethod(
arg1, arg2,
arg3, arg4, arg5); |
false |
|---|
CallMethod(arg1, arg2,
arg3, arg4, arg5); |
呼び出しで「)」の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_invocation_rpar , [resharper_]wrap_before_invocation_rpar
使用可能な値:
true | false
例:
true |
|---|
CallMethod(arg1, arg2,
arg3, arg4, arg5
); |
false |
|---|
CallMethod(arg1, arg2,
arg3, arg4, arg5); |
メンバーアクセス式の配置
「.」の後に折り返すことを好む
プロパティ名:
[resharper_]csharp_wrap_after_dot_in_method_calls , [resharper_]wrap_after_dot_in_method_calls
使用可能な値:
true | false
例:
true |
|---|
obj.Method().
Method().
Method().
Method().
Method().
Method().
Method().
Method().
Method().
Method(); |
false |
|---|
obj.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method(); |
チェーンされたメソッド呼び出しをラップする
プロパティ名:
[resharper_]csharp_wrap_chained_method_calls , [resharper_]wrap_chained_method_calls
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
obj.Method().Method() +
obj.Method().Method()
.Method().Method()
.Method().Method()
.Method().Method()
.Method().Method(); |
chop_if_long |
|---|
obj.Method().Method() +
obj.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method(); |
chop_always |
|---|
obj.Method()
.Method() +
obj.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method(); |
最初のメソッド呼び出しの前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_first_method_call , [resharper_]wrap_before_first_method_call
使用可能な値:
true | false
例:
true |
|---|
obj
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method(); |
false |
|---|
obj.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method()
.Method(); |
連鎖メソッド呼び出しのプロパティとフィールドの後にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_after_property_in_chained_method_calls , [resharper_]wrap_after_property_in_chained_method_calls
使用可能な値:
true | false
例:
true |
|---|
obj.Property
.Method()
.Property
.Method()
.Property
.Method()
.Property
.Method()
.Property
.Method(); |
false |
|---|
obj.Property.Method()
.Property.Method()
.Property.Method()
.Property.Method()
.Property.Method(); |
バイナリ式の配置
二項式で演算子の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_binary_opsign , [resharper_]wrap_before_binary_opsign
使用可能な値:
true | false
例:
true |
|---|
myField1 = expression1
+ expression2
+ expression3
+ expression4
+ expression5
+ expression6
+ expression7; |
false |
|---|
myField1 = expression1 +
expression2 +
expression3 +
expression4 +
expression5 +
expression6 +
expression7; |
連鎖バイナリ式をラップする
プロパティ名:
[resharper_]csharp_wrap_chained_binary_expressions , [resharper_]wrap_chained_binary_expressions
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップ
例:
wrap_if_long |
|---|
b = a != b && c != d && e &&
f.IsSumOf(g, h) &&
i.Value == j && k == l &&
m == n && o == p; |
chop_if_long |
|---|
b = a != b &&
c != d &&
e &&
f.IsSumOf(g, h) &&
i.Value == j &&
k == l &&
m == n &&
o == p; |
バイナリパターンで演算子の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_binary_pattern_op , [resharper_]wrap_before_binary_pattern_op
使用可能な値:
true | false
例:
true |
|---|
b = foo is VeryLongName1
or VeryLongName2
or VeryLongName3
or VeryLongName4
or VeryLongName5; |
false |
|---|
b = foo is VeryLongName1 or
VeryLongName2 or
VeryLongName3 or
VeryLongName4 or
VeryLongName5; |
複雑なバイナリパターンをラップする
プロパティ名:
[resharper_]csharp_wrap_chained_binary_patterns , [resharper_]wrap_chained_binary_patterns
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップ
例:
wrap_if_long |
|---|
b = foo is C1 or C2 or C3 or C4
or C5 or VeryLongName1
or VeryLongName2
or VeryLongName3; |
chop_if_long |
|---|
b = foo is C1
or C2
or C3
or C4
or C5
or VeryLongName1
or VeryLongName2
or VeryLongName3; |
'if' ステートメントで強制チョップ複合条件
プロパティ名:
[resharper_]csharp_force_chop_compound_if_expression , [resharper_]force_chop_compound_if_expression
使用可能な値:
true | false
例:
true |
|---|
if (var1 == null ||
var2 == null)
Foo(); |
false |
|---|
if (var1 == null || var2 == null)
Foo(); |
'while' ステートメントで強制チョップ複合条件
プロパティ名:
[resharper_]csharp_force_chop_compound_while_expression , [resharper_]force_chop_compound_while_expression
使用可能な値:
true | false
例:
true |
|---|
while (var1 == null ||
var2 == null)
Foo(); |
false |
|---|
while (var1 == null || var2 == null)
Foo(); |
'do' ステートメントで強制的なチョップ複合条件
プロパティ名:
[resharper_]csharp_force_chop_compound_do_expression , [resharper_]force_chop_compound_do_expression
使用可能な値:
true | false
例:
true |
|---|
do
{
Foo();
} while (var1 == null ||
var2 == null); |
false |
|---|
do
{
Foo();
} while (var1 == null || var2 == null); |
三項演算子の配置
「?」の前に折り返すことを好む三項演算子の「:」
プロパティ名:
[resharper_]csharp_wrap_before_ternary_opsigns , [resharper_]wrap_before_ternary_opsigns
使用可能な値:
true | false
例:
true |
|---|
return hereGoesSomeBoolExpression
? returnThisIfTrue
: returnThatIfFalse; |
false |
|---|
return hereGoesSomeBoolExpression ?
returnThisIfTrue :
returnThatIfFalse; |
ラップ三項演算子
プロパティ名:
[resharper_]csharp_wrap_ternary_expr_style , [resharper_]wrap_ternary_expr_style
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
myField = someCondition ? true
: false; |
chop_if_long |
|---|
myField = someCondition
? true
: false; |
chop_always |
|---|
myField = someCondition
? true
: false; |
ネストされた三項演算子スタイル
プロパティ名:
[resharper_]csharp_nested_ternary_style , [resharper_]nested_ternary_style
使用可能な値:
simple_wrap: シンプルラップ / 変更しないautodetect: 既存のスタイルのチョップcompact: コンパクトなスタイルのチョップexpanded: 拡張スタイルのチョップ
例:
フォーマット前 | フォーマット後 simple_wrap |
|---|---|
{
a = i ? "am" : you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} | {
a = i ? "am" : you ? "are"
: "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} |
フォーマット前 | フォーマット後 autodetect |
|---|---|
{
a = i ? "am" : you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} | {
a = i ? "am" :
you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} |
フォーマット前 | フォーマット後 compact |
|---|---|
{
a = i ? "am" : you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} | {
a = i ? "am" :
you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger ? dangerous :
cat ? cute : boring;
d = roses ? red :
violets ? blue :
so_are_you;
} |
フォーマット前 | フォーマット後 expanded |
|---|---|
{
a = i ? "am" : you ? "are" : "is";
b = error ? red :
warning ? yellow :
green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses ? red
: violets ? blue
: so_are_you;
} | {
a = i
? "am"
: you
? "are"
: "is";
b = error
? red
: warning
? yellow
: green;
c = tiger
? dangerous
: cat
? cute
: boring;
d = roses
? red
: violets
? blue
: so_are_you;
} |
LINQ 式の配置
ラップ LINQ 式
プロパティ名:
[resharper_]csharp_wrap_linq_expressions , [resharper_]wrap_linq_expressions
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップchop_always: 常にチョップ
例:
wrap_if_long |
|---|
var result = from x in list
where cond(x) select x; |
chop_if_long |
|---|
var result = from x in list
where cond(x)
select x; |
chop_always |
|---|
var result = from x in list
where cond(x)
select x; |
複数行の LINQ 式の前にラップすることを好む
プロパティ名:
[resharper_]csharp_wrap_before_linq_expression , [resharper_]wrap_before_linq_expression
使用可能な値:
true | false
例:
true |
|---|
var result =
from x in list
where cond(x)
select x; |
false |
|---|
var result = from x in list
where cond(x)
select x; |
LINQ 式の新しい行に 'into' を配置する
プロパティ名:
[resharper_]csharp_place_linq_into_on_new_line , [resharper_]place_linq_into_on_new_line
使用可能な値:
true | false
例:
true |
|---|
var q1 = from i in l
select i
into j
where j != 0
select j; |
false |
|---|
var q1 = from i in l
select i into j
where j != 0
select j; |
補間された文字列の配列
補間された文字列をラップする
プロパティ名:
[resharper_]csharp_wrap_verbatim_interpolated_strings , [resharper_]wrap_verbatim_interpolated_strings
使用可能な値:
wrap_if_long: シンプルラップchop_if_long: ロングまたは複数行の場合はチョップno_wrap: 長くてもラップしないでください
例:
wrap_if_long |
|---|
var s1 = $"id={id} src={src
} dest={dest}";
var s2 = $@"id={id} src={src
} dest={dest}";
var s3 = $"""
id={id} src={src
} dest={dest}
"""; |
chop_if_long |
|---|
var s1 = $"id={
id
} src={
src
} dest={
dest
}";
var s2 = $@"id={
id
} src={
src
} dest={
dest
}";
var s3 = $"""
id={
id
} src={
src
} dest={
dest
}
"""; |
no_wrap |
|---|
var s1 =
$"id={id} src={src} dest={dest}";
var s2 =
$@"id={id} src={src} dest={dest}";
var s3 = $"""
id={id} src={src} dest={dest}
"""; |
関連ページ:
EditorConfig を使用する
ReSharper は、EditorConfig 形式で定義されたコード形式スタイル、コード構文スタイル、C# の命名スタイル、コードインスペクション重大度レベルをサポートします。まず、この 2 分間の概要ビデオを見て、Matt Ellis が EditorConfig を使用してフォーマットルールの構成全体を維持するのに ReSharper がどのように役立つかを説明します。EditorConfig とは何ですか? ReSharper はどのようにそれを拡張しますか? :EditorConfig...
C# の EditorConfig プロパティ: タブ、インデント、アライメント
このページでは、C# でフォーマット設定を構成するために使用できるカスタム ReSharperEditorConfig プロパティの一覧を示します。具体的には、さまざまなコード構成をインデントおよび整列する方法です。一般:インデントスタイルプロパティ名:, 使用可能な値:: タブ、: スペース、例:if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }if (condition) { if (...