C# の EditorConfig プロパティ: タブ、インデント、アライメント
このページでは、C# のフォーマット環境設定、具体的にはさまざまなコード構造のインデントや配置方法を設定するために使用できるカスタム ReSharper EditorConfig プロパティを一覧で紹介します。
一般
インデントスタイル
プロパティ名:
indent_style, [resharper_]csharp_indent_style
使用可能な値:
tab: タブspace: スペース
例:
tab |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
space |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
インデントサイズ
プロパティ名:
indent_size, [resharper_]csharp_indent_size
使用可能な値:
整数
例:
値: 0 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
値: 1 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
値: 2 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
タブの幅
プロパティ名:
tab_width, [resharper_]csharp_tab_width
使用可能な値:
整数
例:
値: 0 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
値: 1 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
値: 2 |
|---|
if (condition)
{
if (condition1)
{
foo1();
foo2();
}
else
{
foo3();
foo4();
}
}
|
継続行のインデント乗数
プロパティ名:
[resharper_]csharp_continuous_indent_multiplier, [resharper_]continuous_indent_multiplier
使用可能な値:
整数
例:
値: 0 |
|---|
int x = foo1() +
foo2();
|
値: 1 |
|---|
int x = foo1() +
foo2();
|
値: 2 |
|---|
int x = foo1() +
foo2();
|
ネストされたステートメント
入れ子になった 'using' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_usings_stmt, [resharper_]indent_nested_usings_stmt
使用可能な値:
true | false
例:
true |
|---|
using (A a = new A())
using (B b = new B())
using (C c = new C())
{
foo();
}
|
false |
|---|
using (A a = new A())
using (B b = new B())
using (C c = new C())
{
foo();
}
|
入れ子になった 'fixed' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_fixed_stmt, [resharper_]indent_nested_fixed_stmt
使用可能な値:
true | false
例:
true |
|---|
fixed (int* a = &x)
fixed (int* b = &y)
fixed (int* c = &z)
{
foo();
}
|
false |
|---|
fixed (int* a = &x)
fixed (int* b = &y)
fixed (int* c = &z)
{
foo();
}
|
入れ子になった 'lock' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_lock_stmt, [resharper_]indent_nested_lock_stmt
使用可能な値:
true | false
例:
true |
|---|
lock (a)
lock (b)
lock (c)
{
foo();
}
|
false |
|---|
lock (a)
lock (b)
lock (c)
{
foo();
}
|
入れ子になった 'for' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_for_stmt, [resharper_]indent_nested_for_stmt
使用可能な値:
true | false
例:
true |
|---|
for (int a = 0; a < x; a++)
for (int b = 0; b < y; b++)
for (int c = 0; c < y; c++)
{
foo();
}
|
false |
|---|
for (int a = 0; a < x; a++)
for (int b = 0; b < y; b++)
for (int c = 0; c < y; c++)
{
foo();
}
|
入れ子になった 'foreach' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_foreach_stmt, [resharper_]indent_nested_foreach_stmt
使用可能な値:
true | false
例:
true |
|---|
foreach (var a in x)
foreach (var b in y)
foreach (var c in z)
{
foo();
}
|
false |
|---|
foreach (var a in x)
foreach (var b in y)
foreach (var c in z)
{
foo();
}
|
入れ子になった 'while' ステートメント
プロパティ名:
[resharper_]csharp_indent_nested_while_stmt, [resharper_]indent_nested_while_stmt
使用可能な値:
true | false
例:
true |
|---|
while (a)
while (b)
while (c)
{
foo();
}
|
false |
|---|
while (a)
while (b)
while (c)
{
foo();
}
|
括弧
丸括弧内の継続行インデントを使用する
プロパティ名:
[resharper_]csharp_use_continuous_indent_inside_parens, [resharper_]use_continuous_indent_inside_parens
使用可能な値:
true | false
例:
true |
|---|
var x = Method(
parameter1,
parameter2
);
|
false |
|---|
var x = Method(
parameter1,
parameter2
);
|
メソッド宣言の丸括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_method_decl_pars, [resharper_]indent_method_decl_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
void Method(
int parameter1,
int parameter2
);
|
outside |
|---|
void Method(
int parameter1,
int parameter2
);
|
outside_and_inside |
|---|
void Method(
int parameter1,
int parameter2
);
|
none |
|---|
void Method(
int parameter1,
int parameter2
);
|
プライマリコンストラクター宣言の丸括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_primary_constructor_decl_pars, [resharper_]indent_primary_constructor_decl_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
record Person(
string Name,
int Age
);
|
outside |
|---|
record Person(
string Name,
int Age
);
|
outside_and_inside |
|---|
record Person(
string Name,
int Age
);
|
none |
|---|
record Person(
string Name,
int Age
);
|
メソッド呼び出しの丸括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_invocation_pars, [resharper_]indent_invocation_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
var x = Method(
parameter1,
parameter2
);
|
outside |
|---|
var x = Method(
parameter1,
parameter2
);
|
outside_and_inside |
|---|
var x = Method(
parameter1,
parameter2
);
|
none |
|---|
var x = Method(
parameter1,
parameter2
);
|
ステートメント(if、while、for など)の丸括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_statement_pars, [resharper_]indent_statement_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
if (
condition1 &&
condition2
)
return;
|
outside |
|---|
if (
condition1 &&
condition2
)
return;
|
outside_and_inside |
|---|
if (
condition1 &&
condition2
)
return;
|
none |
|---|
if (
condition1 &&
condition2
)
return;
|
型パラメーターの山括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_typeparam_angles, [resharper_]indent_typeparam_angles
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
void Method<
T1,
T2
>();
|
outside |
|---|
void Method<
T1,
T2
>();
|
outside_and_inside |
|---|
void Method<
T1,
T2
>();
|
none |
|---|
void Method<
T1,
T2
>();
|
型引数の山括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_typearg_angles, [resharper_]indent_typearg_angles
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
var x = Method<
Class1,
Class2
>();
|
outside |
|---|
var x = Method<
Class1,
Class2
>();
|
outside_and_inside |
|---|
var x = Method<
Class1,
Class2
>();
|
none |
|---|
var x = Method<
Class1,
Class2
>();
|
他の丸括弧および角括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_pars, [resharper_]indent_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
var x = 1 * checked(
5 +
6
);
|
outside |
|---|
var x = 1 * checked(
5 +
6
);
|
outside_and_inside |
|---|
var x = 1 * checked(
5 +
6
);
|
none |
|---|
var x = 1 * checked(
5 +
6
);
|
プリプロセッサーディレクティブ
#if、#else、#elif、#endif をインデントする
プロパティ名:
[resharper_]csharp_indent_preprocessor_if, [resharper_]indent_preprocessor_if
使用可能な値:
no_indent: インデントしないusual_indent: 通常どおりインデントするoutdent: アウトデントdo_not_change: 変更しない
例:
no_indent |
|---|
namespace N
{
class C
{
#if !HideSomething
int myField;
#endif
}
}
|
usual_indent |
|---|
namespace N
{
class C
{
#if !HideSomething
int myField;
#endif
}
}
|
outdent |
|---|
namespace N
{
class C
{
#if !HideSomething
int myField;
#endif
}
}
|
do_not_change |
|---|
namespace N
{
class C
{
#if !HideSomething
int myField;
#endif
}
}
|
#region、#endregion をインデントする
プロパティ名:
[resharper_]csharp_indent_preprocessor_region, [resharper_]indent_preprocessor_region
使用可能な値:
no_indent: インデントしないusual_indent: 通常どおりインデントするoutdent: アウトデントdo_not_change: 変更しない
例:
no_indent |
|---|
namespace N
{
class C
{
#region Fields
int myField;
#endregion
}
}
|
usual_indent |
|---|
namespace N
{
class C
{
#region Fields
int myField;
#endregion
}
}
|
outdent |
|---|
namespace N
{
class C
{
#region Fields
int myField;
#endregion
}
}
|
do_not_change |
|---|
namespace N
{
class C
{
#region Fields
int myField;
#endregion
}
}
|
他のプリプロセッサディレクティブをインデントする
プロパティ名:
[resharper_]csharp_indent_preprocessor_other, [resharper_]indent_preprocessor_other
使用可能な値:
no_indent: インデントしないusual_indent: 通常どおりインデントするoutdent: アウトデントdo_not_change: 変更しない
例:
no_indent |
|---|
namespace N
{
class C
{
#pragma warning disable CS3021
int myField;
#warning Fixme
}
}
|
usual_indent |
|---|
namespace N
{
class C
{
#pragma warning disable CS3021
int myField;
#warning Fixme
}
}
|
outdent |
|---|
namespace N
{
class C
{
#pragma warning disable CS3021
int myField;
#warning Fixme
}
}
|
do_not_change |
|---|
namespace N
{
class C
{
#pragma warning disable CS3021
int myField;
#warning Fixme
}
}
|
その他のインデント
'switch' から 'case' をインデント
プロパティ名:
csharp_indent_switch_labels, [resharper_]indent_switch_labels
使用可能な値:
true | false
例:
true |
|---|
switch (expression)
{
case 0:
break;
}
|
false |
|---|
switch (expression)
{
case 0:
break;
}
|
ステートメントラベルのインデント解除
プロパティ名:
[resharper_]csharp_outdent_statement_labels, [resharper_]outdent_statement_labels
使用可能な値:
true | false
例:
true |
|---|
{
int a = 5;
MyLabel:
a--;
if (a > 0) goto MyLabel;
}
|
false |
|---|
{
int a = 5;
MyLabel:
a--;
if (a > 0) goto MyLabel;
}
|
型制約をインデントする
プロパティ名:
[resharper_]csharp_indent_type_constraints, [resharper_]indent_type_constraints
使用可能な値:
true | false
例:
true |
|---|
class C1<T1>
where T1 : I1
{
}
|
false |
|---|
class C1<T1>
where T1 : I1
{
}
|
最初の列から始まるコメントはインデントしない
プロパティ名:
[resharper_]csharp_stick_comment, [resharper_]stick_comment
使用可能な値:
true | false
例:
フォーマット前 | フォーマット後 true |
|---|---|
namespace N {
// Some comment
class C {
}
}
| namespace N
{
// Some comment
class C
{
}
}
|
フォーマット前 | フォーマット後 false |
|---|---|
namespace N {
// Some comment
class C {
}
}
| namespace N
{
// Some comment
class C
{
}
}
|
コードをコメントアウトする時は最初の列にコメントを配置する
プロパティ名:
[resharper_]csharp_place_comments_at_first_column, [resharper_]place_comments_at_first_column
使用可能な値:
true | false
部分フォーマットで前の要素のインデントを使用する
プロパティ名:
[resharper_]csharp_use_indent_from_previous_element, [resharper_]use_indent_from_previous_element
使用可能な値:
true | false
ステートメント条件内の中括弧をインデントする
プロパティ名:
[resharper_]csharp_indent_braces_inside_statement_conditions, [resharper_]indent_braces_inside_statement_conditions
使用可能な値:
true | false
例:
true |
|---|
while (x is IMyInterface
{
Prop1: 1,
Prop2: 2
})
{
DoSomething();
}
|
false |
|---|
while (x is IMyInterface
{
Prop1: 1,
Prop2: 2
})
{
DoSomething();
}
|
複数行構成の整列
タブがインデントに使用されているときの整列方法
プロパティ名:
[resharper_]csharp_alignment_tab_fill_style, [resharper_]alignment_tab_fill_style
使用可能な値:
use_spaces: スペースを使用する (任意のタブサイズで整列して見える)use_tabs_only: タブのみを使用する (不正確)optimal_fill: 最適な塗りつぶしのためにタブとスペースをミックス
例:
use_spaces |
|---|
SomeMyMethod(param1,
param2);
|
use_tabs_only |
|---|
SomeMyMethod(param1,
param2);
|
optimal_fill |
|---|
SomeMyMethod(param1,
param2);
|
インデントが大きくなりすぎても整列する
プロパティ名:
[resharper_]csharp_allow_far_alignment, [resharper_]allow_far_alignment
使用可能な値:
true | false
メソッド パラメーター
プロパティ名:
[resharper_]csharp_align_multiline_parameter, [resharper_]align_multiline_parameter
使用可能な値:
true | false
例:
true |
|---|
void fooCall(int firstParameter,
int secondParameter)
{
}
|
false |
|---|
void fooCall(int firstParameter,
int secondParameter)
{
}
|
基底クラスとインターフェースのリスト
プロパティ名:
[resharper_]csharp_align_multiline_extends_list, [resharper_]align_multiline_extends_list
使用可能な値:
true | false
例:
true |
|---|
class C : BaseClass,
SomeInterface
{
}
|
false |
|---|
class C : BaseClass,
SomeInterface
{
}
|
LINQ クエリ
プロパティ名:
[resharper_]csharp_align_linq_query, [resharper_]align_linq_query
使用可能な値:
true | false
例:
true |
|---|
var q = from x in xs
where x != null
select x;
|
false |
|---|
var q = from x in xs
where x != null
select x;
|
バイナリ式かつ連鎖式
プロパティ名:
[resharper_]csharp_align_multiline_binary_expressions_chain, [resharper_]align_multiline_binary_expressions_chain
使用可能な値:
true | false
例:
true |
|---|
var a = someOperand + operand2
+ operand3
+ operand4;
|
false |
|---|
var a = someOperand + operand2
+ operand3
+ operand4;
|
バイナリ演算子のインデント解除
プロパティ名:
[resharper_]csharp_outdent_binary_ops, [resharper_]outdent_binary_ops
使用可能な値:
true | false
例:
true |
|---|
{
var a =
someOperand
+ operand2
+ operand3
+ operand4;
var b = someOperand
+ operand2
+ operand3
+ operand4;
}
|
false |
|---|
{
var a =
someOperand
+ operand2
+ operand3
+ operand4;
var b = someOperand
+ operand2
+ operand3
+ operand4;
}
|
チェーンメソッド呼び出し
プロパティ名:
[resharper_]csharp_align_multiline_calls_chain, [resharper_]align_multiline_calls_chain
使用可能な値:
true | false
例:
true |
|---|
MyVar.SomeMethod()
.OtherMethod()
.ThirdMethod();
|
false |
|---|
MyVar.SomeMethod()
.OtherMethod()
.ThirdMethod();
|
チェーンメソッド呼び出しのドットのインデント解除
プロパティ名:
[resharper_]csharp_outdent_dots, [resharper_]outdent_dots
使用可能な値:
true | false
例:
true |
|---|
{
var a =
MyVar
.SomeMethod()
?.OtherMethod()
.ThirdMethod();
var b = MyVar
.SomeMethod()
?.OtherMethod()
.ThirdMethod();
}
|
false |
|---|
{
var a =
MyVar
.SomeMethod()
?.OtherMethod()
.ThirdMethod();
var b = MyVar
.SomeMethod()
?.OtherMethod()
.ThirdMethod();
}
|
配列、オブジェクト、コレクションイニシャライザー
プロパティ名:
[resharper_]csharp_align_multiline_array_and_object_initializer, [resharper_]align_multiline_array_and_object_initializer
使用可能な値:
true | false
例:
true |
|---|
StudentName student = new StudentName
{
FirstName = "John",
LastName = "Smith",
ID = 116
}
|
false |
|---|
StudentName student = new StudentName
{
FirstName = "John",
LastName = "Smith",
ID = 116
}
|
Switch 式
プロパティ名:
[resharper_]csharp_align_multiline_switch_expression, [resharper_]align_multiline_switch_expression
使用可能な値:
true | false
例:
true |
|---|
var z = op switch {
op.Add => x + y,
op.Subtract => x - y,
op.Multiply => x * y,
op.Divide => x / y
}
|
false |
|---|
var z = op switch {
op.Add => x + y,
op.Subtract => x - y,
op.Multiply => x * y,
op.Divide => x / y
}
|
プロパティパターン
プロパティ名:
[resharper_]csharp_align_multiline_property_pattern, [resharper_]align_multiline_property_pattern
使用可能な値:
true | false
例:
true |
|---|
bool matches = sourceObject is MyType {
Field1: 1,
Field2: 2,
};
|
false |
|---|
bool matches = sourceObject is MyType {
Field1: 1,
Field2: 2,
};
|
リストパターンとコレクション式
プロパティ名:
[resharper_]csharp_align_multiline_list_pattern, [resharper_]align_multiline_list_pattern
使用可能な値:
true | false
例:
true |
|---|
int[] collection = [
1,
2,
3
];
var matches = collection is [
1,
> 0,
not 42
];
|
false |
|---|
int[] collection = [
1,
2,
3
];
var matches = collection is [
1,
> 0,
not 42
];
|
バイナリパターン
プロパティ名:
[resharper_]csharp_align_multiline_binary_patterns, [resharper_]align_multiline_binary_patterns
使用可能な値:
true | false
例:
true |
|---|
var a = e is someOperand or operand2
or operand3
or operand4;
|
false |
|---|
var a = e is someOperand or operand2
or operand3
or operand4;
|
バイナリパターンのインデント解除
プロパティ名:
[resharper_]csharp_outdent_binary_pattern_ops, [resharper_]outdent_binary_pattern_ops
使用可能な値:
true | false
例:
true |
|---|
{
var a = e is
someOperand
or operand2
or operand3
or operand4;
var b = e is someOperand
or operand2
or operand3
or operand4;
}
|
false |
|---|
{
var a = e is
someOperand
or operand2
or operand3
or operand4;
var b = e is someOperand
or operand2
or operand3
or operand4;
}
|
匿名メソッド本体
プロパティ名:
[resharper_]csharp_indent_anonymous_method_block, [resharper_]indent_anonymous_method_block
使用可能な値:
true | false
例:
true |
|---|
FooCall(delegate
{
DoSomething();
return 0;
});
|
false |
|---|
FooCall(delegate
{
DoSomething();
return 0;
});
|
'(' での引数の呼び出し
プロパティ名:
[resharper_]csharp_align_first_arg_by_paren, [resharper_]align_first_arg_by_paren
使用可能な値:
true | false
例:
true |
|---|
fooCall(
firstParameter,
secondParameter);
|
false |
|---|
fooCall(
firstParameter,
secondParameter);
|
呼び出し引数
プロパティ名:
[resharper_]csharp_align_multiline_argument, [resharper_]align_multiline_argument
使用可能な値:
true | false
例:
true |
|---|
fooCall(firstParameter,
secondParameter);
|
false |
|---|
fooCall(firstParameter,
secondParameter);
|
タプルコンポーネント
プロパティ名:
[resharper_]csharp_align_tuple_components, [resharper_]align_tuple_components
使用可能な値:
true | false
例:
true |
|---|
var tuple = (firstParameter,
secondParameter);
|
false |
|---|
var tuple = (firstParameter,
secondParameter);
|
その他の式
プロパティ名:
[resharper_]csharp_align_multiline_expression, [resharper_]align_multiline_expression
使用可能な値:
true | false
例:
true |
|---|
destination = source1
? source2
: source3
|
false |
|---|
destination = source1
? source2
: source3
|
丸括弧内のステートメント条件
プロパティ名:
[resharper_]csharp_align_multiline_statement_conditions, [resharper_]align_multiline_statement_conditions
使用可能な値:
true | false
例:
true |
|---|
while (x is IMyInterface or
IMyInterface2 or
IMyInterface3
{
Prop1: 1,
Prop2: 2
})
{
DoSomething();
}
|
false |
|---|
while (x is IMyInterface or
IMyInterface2 or
IMyInterface3
{
Prop1: 1,
Prop2: 2
})
{
DoSomething();
}
|
'for' ステートメントヘッダー
プロパティ名:
[resharper_]csharp_align_multiline_for_stmt, [resharper_]align_multiline_for_stmt
使用可能な値:
true | false
例:
true |
|---|
for (int i = 0;
i < 10;
i++)
{
}
|
false |
|---|
for (int i = 0;
i < 10;
i++)
{
}
|
複数の宣言
プロパティ名:
[resharper_]csharp_align_multiple_declaration, [resharper_]align_multiple_declaration
使用可能な値:
true | false
例:
true |
|---|
class C
{
private int i = 0,
j = 10;
}
|
false |
|---|
class C
{
private int i = 0,
j = 10;
}
|
型パラメーターリスト
プロパティ名:
[resharper_]csharp_align_multline_type_parameter_list, [resharper_]align_multline_type_parameter_list
使用可能な値:
true | false
例:
true |
|---|
class Class<T1,
T2,
T3>
{
}
|
false |
|---|
class Class<T1,
T2,
T3>
{
}
|
型パラメーターの制約
プロパティ名:
[resharper_]csharp_align_multline_type_parameter_constrains, [resharper_]align_multline_type_parameter_constrains
使用可能な値:
true | false
例:
true |
|---|
class C<T1, T2> where T1 : I1
where T2 : I1
{
}
|
false |
|---|
class C<T1, T2> where T1 : I1
where T2 : I1
{
}
|
インデント解除されたコンマ
プロパティ名:
[resharper_]csharp_outdent_commas, [resharper_]outdent_commas
使用可能な値:
true | false
例:
true |
|---|
class Class<
T1
, T3> :
Base
, SomeInterface
{
void fooCall(
int firstParameter
, int secondParameter)
{
fooCall(
firstParameter
, secondParameter);
}
}
|
false |
|---|
class Class<
T1
, T3> :
Base
, SomeInterface
{
void fooCall(
int firstParameter
, int secondParameter)
{
fooCall(
firstParameter
, secondParameter);
}
}
|
複数行コメントをアスタリスクで揃える
プロパティ名:
[resharper_]csharp_align_multiline_comments, [resharper_]align_multiline_comments
使用可能な値:
true | false
例:
true |
|---|
DoSomething(); /* This is
* badly aligned
* comment
*/
|
false |
|---|
DoSomething(); /* This is
* badly aligned
* comment
*/
|
生の文字列リテラルをインデントする方法
プロパティ名:
[resharper_]csharp_indent_raw_literal_string, [resharper_]indent_raw_literal_string
使用可能な値:
align: 位置合わせindent: 前の行へのインデントdo_not_change: 変更しない
例:
align |
|---|
string x = """
Some literal text
with indents
or without
""";
|
indent |
|---|
string x = """
Some literal text
with indents
or without
""";
|
do_not_change |
|---|
string x = """
Some literal text
with indents
or without
""";
|
類似のコードを列に整列する
隣接する行の列位置合わせを修正
プロパティ名:
[resharper_]csharp_int_align_fix_in_adjacent, [resharper_]int_align_fix_in_adjacent
使用可能な値:
true | false
フィールドと定数
プロパティ名:
[resharper_]csharp_int_align_fields、 [resharper_]csharp_int_align、 [resharper_]int_align_fields、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
class C
{
[Attr] private string x = "x";
[Attr(2)] public SomeClass xxxxx = "xxxxx";
[Attr, Attr3] private string xxx;
}
|
false |
|---|
class C
{
[Attr] private string x = "x";
[Attr(2)] public SomeClass xxxxx = "xxxxx";
[Attr, Attr3] private string xxx;
}
|
プロパティとイベント
プロパティ名:
[resharper_]csharp_int_align_properties、 [resharper_]csharp_int_align、 [resharper_]int_align_properties、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
class C
{
[Attr] private string x { get; set; } = "x";
[Attr(2)] public SomeClass xxxxx { get; set; } = SomeClass.Default;
[Attr, Attr3] private string xxx { get; }
[Attr] private string x2 => "x";
[Attr(2)] public SomeClass xxxxx2 => "xxxxx";
[Attr, Attr3] private string xxx2 => "xxx";
}
|
false |
|---|
class C
{
[Attr] private string x { get; set; } = "x";
[Attr(2)] public SomeClass xxxxx { get; set; } = SomeClass.Default;
[Attr, Attr3] private string xxx { get; }
[Attr] private string x2 => "x";
[Attr(2)] public SomeClass xxxxx2 => "xxxxx";
[Attr, Attr3] private string xxx2 => "xxx";
}
|
単純なメソッド、演算子、デリゲート
プロパティ名:
[resharper_]csharp_int_align_methods、 [resharper_]csharp_int_align、 [resharper_]int_align_methods、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
class C
{
[Attr] private string x(int p) { return "x" + p; };
[Attr(2)] public SomeClass xxxxx(string b) { return b.ToSomeClass(); }
[Attr, Attr3] private string xxx() { return null; }
[Attr] private string x2(int p) => "x" + p;
[Attr(2)] public SomeClass xxxxx2(string b) => b.ToSomeClass();
[Attr, Attr3] private string xxx() => null;
}
|
false |
|---|
class C
{
[Attr] private string x(int p) { return "x" + p; };
[Attr(2)] public SomeClass xxxxx(string b) { return b.ToSomeClass(); }
[Attr, Attr3] private string xxx() { return null; }
[Attr] private string x2(int p) => "x" + p;
[Attr(2)] public SomeClass xxxxx2(string b) => b.ToSomeClass();
[Attr, Attr3] private string xxx() => null;
}
|
複数行のメソッドシグネチャー
プロパティ名:
[resharper_]csharp_int_align_parameters、 [resharper_]csharp_int_align、 [resharper_]int_align_parameters、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
void MyMethod(
[Attr, Attr3] string xxx,
[Attr] string x = "x",
[Attr(2)] SomeClass xxxxx = "xxxxx")
{
}
|
false |
|---|
void MyMethod(
[Attr, Attr3] string xxx,
[Attr] string x = "x",
[Attr(2)] SomeClass xxxxx = "xxxxx")
{
}
|
変数とローカル定数
プロパティ名:
[resharper_]csharp_int_align_variables、 [resharper_]csharp_int_align、 [resharper_]int_align_variables、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
{
var x = 1;
var xxxxx = 2;
var xxx = 2;
}
|
false |
|---|
{
var x = 1;
var xxxxx = 2;
var xxx = 2;
}
|
その他の代入およびイニシャライザー
プロパティ名:
[resharper_]csharp_int_align_assignments、 [resharper_]csharp_int_align、 [resharper_]int_align_assignments、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
{
x = 1;
xxxxx = 2;
xxx = 2;
}
|
false |
|---|
{
x = 1;
xxxxx = 2;
xxx = 2;
}
|
プロパティパターン
プロパティ名:
[resharper_]csharp_int_align_property_patterns、 [resharper_]csharp_int_align、 [resharper_]int_align_property_patterns、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
bool matches = sourceObject is MyType
{
FShort : 1,
FieldLongLong: 2,
};
|
false |
|---|
bool matches = sourceObject is MyType
{
FShort: 1,
FieldLongLong: 2,
};
|
ネストした三項演算子
プロパティ名:
[resharper_]csharp_int_align_nested_ternary、 [resharper_]csharp_int_align、 [resharper_]int_align_nested_ternary、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
var x =
y == "a" ? 1 :
y == "aaaa" ? 4 :
y == "aa" ? 2 :
0;
|
false |
|---|
var x =
y == "a" ? 1 :
y == "aaaa" ? 4 :
y == "aa" ? 2 :
0;
|
同じメソッドの呼び出し
プロパティ名:
[resharper_]csharp_int_align_invocations、 [resharper_]csharp_int_align、 [resharper_]int_align_invocations、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
[Attr("x", 1234567)]
[Attr("xxxxx", 1)]
[Attr(MyEnum.MyConstant, 124)]
void MyMethod()
{
CallMe("x", 1234567);
CallMe("xxxxx", 1);
CallMe(MyEnum.MyConstant, 124);
}
|
false |
|---|
[Attr("x", 1234567)]
[Attr("xxxxx", 1)]
[Attr(MyEnum.MyConstant, 124)]
void MyMethod()
{
CallMe("x", 1234567);
CallMe("xxxxx", 1);
CallMe(MyEnum.MyConstant, 124);
}
|
バイナリ式かつ連鎖式
プロパティ名:
[resharper_]csharp_int_align_binary_expressions、 [resharper_]csharp_int_align、 [resharper_]int_align_binary_expressions、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
if (
zzz ||
someCondition && otherCondition ||
aa && bb ||
x == "a" ||
xxxxxxx != "aaaa" ||
xx > "aa")
{
DoSomething();
}
|
false |
|---|
if (
zzz ||
someCondition && otherCondition ||
aa && bb ||
x == "a" ||
xxxxxxx != "aaaa" ||
xx > "aa")
{
DoSomething();
}
|
コメントの終了
プロパティ名:
[resharper_]csharp_int_align_comments、 [resharper_]csharp_int_align、 [resharper_]int_align_comments、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
{
DoSomething(); // I'm
var y = 6; // forced
while (y > 0) y--; // to
DoSomethingElse(); /* document */
var z = 10; /* my code */
while (z < 100) z++; /* profusely */
}
|
false |
|---|
{
DoSomething(); // I'm
var y = 6; // forced
while (y > 0) y--; // to
DoSomethingElse(); /* document */
var z = 10; /* my code */
while (z < 100) z++; /* profusely */
}
|
単純な switch セクション
プロパティ名:
[resharper_]csharp_int_align_switch_sections、 [resharper_]csharp_int_align、 [resharper_]int_align_switch_sections、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
switch (op)
{
case op.Add: return x + y;
case op.Subtract: return x - y;
case op.Multiply: return x * y;
case op.Divide: return x / y;
}
|
false |
|---|
switch (op)
{
case op.Add: return x + y;
case op.Subtract: return x - y;
case op.Multiply: return x * y;
case op.Divide: return x / y;
}
|
Switch 式
プロパティ名:
[resharper_]csharp_int_align_switch_expressions、 [resharper_]csharp_int_align、 [resharper_]int_align_switch_expressions、 [resharper_]int_align
使用可能な値:
true | false
例:
true |
|---|
var z = op switch
{
op.Add => x + y,
op.Subtract => x - y,
op.Multiply => x * y,
op.Divide => x / y
}
|
false |
|---|
var z = op switch
{
op.Add => x + y,
op.Subtract => x - y,
op.Multiply => x * y,
op.Divide => x / y
}
|