C# の EditorConfig プロパティ: スペース
このページでは、フォーマットの設定に使用できるカスタム ReSharper EditorConfig プロパティの一覧を示します。具体的には、さまざまな C# 構成要素でスペースを挿入または削除する方法です。
既存のフォーマットを保持する
内部の余分なスペース
プロパティ名:
[resharper_]csharp_extra_spaces
, [resharper_]extra_spaces
使用可能な値:
remove_all
: 余分なスペースをすべて削除するleave_tabs
: 余分なタブを残すleave_multiple
: 複数の余分なスペースを残すleave_all
: スペースとタブをすべて残す
例:
フォーマット前 | フォーマット後 remove_all |
---|---|
{
var x = foo ( 5 ) ;
var xx = foo ( 5 + 6 ) ;
var xxx = foo ( 5 + 6 + 7 ) ;
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} | {
var x = foo(5);
var xx = foo(5 + 6);
var xxx = foo(5 + 6 + 7);
var tab = foo(5);
var tabx = foo(5 + 6);
var tabxx = foo(5 + 6 + 7);
} |
フォーマット前 | フォーマット後 leave_tabs |
---|---|
{
var x = foo ( 5 ) ;
var xx = foo ( 5 + 6 ) ;
var xxx = foo ( 5 + 6 + 7 ) ;
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} | {
var x = foo(5);
var xx = foo(5 + 6);
var xxx = foo(5 + 6 + 7);
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} |
フォーマット前 | フォーマット後 leave_multiple |
---|---|
{
var x = foo ( 5 ) ;
var xx = foo ( 5 + 6 ) ;
var xxx = foo ( 5 + 6 + 7 ) ;
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} | {
var x = foo(5 );
var xx = foo(5 + 6 );
var xxx = foo(5 + 6 + 7);
var tab = foo(5);
var tabx = foo(5 + 6);
var tabxx = foo(5 + 6 + 7);
} |
フォーマット前 | フォーマット後 leave_all |
---|---|
{
var x = foo ( 5 ) ;
var xx = foo ( 5 + 6 ) ;
var xxx = foo ( 5 + 6 + 7 ) ;
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} | {
var x = foo ( 5 ) ;
var xx = foo ( 5 + 6 ) ;
var xxx = foo ( 5 + 6 + 7 ) ;
var tab = foo ( 5 ) ;
var tabx = foo ( 5 + 6 ) ;
var tabxx = foo ( 5 + 6 + 7 ) ;
} |
ステートメントの括弧の前
'if' の丸括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_if_parentheses
、[resharper_]space_before_if_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
if (condition)
{
foo();
}
else
{
foo();
} |
false |
---|
if(condition)
{
foo();
}
else
{
foo();
} |
'while' の丸括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_while_parentheses
、[resharper_]space_before_while_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
while (condition)
{
do
{
foo();
} while (condition);
} |
false |
---|
while(condition)
{
do
{
foo();
} while(condition);
} |
'catch' の丸括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_catch_parentheses
、[resharper_]space_before_catch_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
try
{
foo();
}
catch (Exception e)
{
} |
false |
---|
try
{
foo();
}
catch(Exception e)
{
} |
'switch' の丸括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_switch_parentheses
、[resharper_]space_before_switch_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
switch (expr)
{
case 0:
break;
} |
false |
---|
switch(expr)
{
case 0:
break;
} |
'for' の丸括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_for_parentheses
、[resharper_]space_before_for_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
for (int i = 0; i < 10; i++)
{
foo();
} |
false |
---|
for(int i = 0; i < 10; i++)
{
foo();
} |
'foreach' 括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_foreach_parentheses
、[resharper_]space_before_foreach_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
foreach (object o in collection)
{
foo();
} |
false |
---|
foreach(object o in collection)
{
foo();
} |
'using' 括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_using_parentheses
、[resharper_]space_before_using_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
using (C c = new C())
{
foo();
} |
false |
---|
using(C c = new C())
{
foo();
} |
'lock' 括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_lock_parentheses
、[resharper_]space_before_lock_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
lock (this)
{
foo();
} |
false |
---|
lock(this)
{
foo();
} |
'fixed' 括弧
プロパティ名:
csharp_space_after_keywords_in_control_flow_statements
、[resharper_]csharp_space_before_fixed_parentheses
、[resharper_]space_before_fixed_parentheses
、[resharper_]space_after_keywords_in_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
fixed (int* fib = new int[1])
{
foo();
} |
false |
---|
fixed(int* fib = new int[1])
{
foo();
} |
他の括弧の前
メソッド呼び出しの丸括弧
プロパティ名:
csharp_space_between_method_call_name_and_opening_parenthesis
、[resharper_]csharp_space_before_method_call_parentheses
、[resharper_]space_before_method_call_parentheses
、[resharper_]space_between_method_call_name_and_opening_parenthesis
使用可能な値:
true | false
例:
true |
---|
void Method()
{
foo1 ("string", true);
foo2();
} |
false |
---|
void Method()
{
foo1("string", true);
foo2();
} |
空の括弧のメソッド呼び出し
プロパティ名:
csharp_space_between_method_call_name_and_opening_parenthesis
、[resharper_]csharp_space_before_empty_method_call_parentheses
、[resharper_]space_before_empty_method_call_parentheses
、[resharper_]space_between_method_call_name_and_opening_parenthesis
使用可能な値:
true | false
例:
true |
---|
void Method()
{
foo1("string", true);
foo2 ();
} |
false |
---|
void Method()
{
foo1("string", true);
foo2();
} |
メソッド宣言の丸括弧
プロパティ名:
csharp_space_between_method_declaration_name_and_open_parenthesis
、[resharper_]csharp_space_before_method_parentheses
、[resharper_]space_before_method_parentheses
、[resharper_]space_between_method_declaration_name_and_open_parenthesis
使用可能な値:
true | false
例:
true |
---|
class C
{
public abstract void Method1 (string str);
public abstract void Method2();
} |
false |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2();
} |
メソッド宣言の空の括弧
プロパティ名:
csharp_space_between_method_declaration_name_and_open_parenthesis
、[resharper_]csharp_space_before_empty_method_parentheses
、[resharper_]space_before_empty_method_parentheses
、[resharper_]space_between_method_declaration_name_and_open_parenthesis
使用可能な値:
true | false
例:
true |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2 ();
} |
false |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2();
} |
'typeof' 括弧
プロパティ名:
[resharper_]csharp_space_before_typeof_parentheses
, [resharper_]space_before_typeof_parentheses
使用可能な値:
true | false
例:
true |
---|
Type t = typeof (bool); |
false |
---|
Type t = typeof(bool); |
'default' 括弧
プロパティ名:
[resharper_]csharp_space_before_default_parentheses
, [resharper_]space_before_default_parentheses
使用可能な値:
true | false
例:
true |
---|
return default (int); |
false |
---|
return default(int); |
'checked' および 'unchecked' 括弧
プロパティ名:
[resharper_]csharp_space_before_checked_parentheses
, [resharper_]space_before_checked_parentheses
使用可能な値:
true | false
例:
true |
---|
return checked (100000 * 10000) + unchecked (10000 * 10000); |
false |
---|
return checked(100000 * 10000) + unchecked(10000 * 10000); |
'sizeof' 括弧
プロパティ名:
[resharper_]csharp_space_before_sizeof_parentheses
, [resharper_]space_before_sizeof_parentheses
使用可能な値:
true | false
例:
true |
---|
int size = sizeof (bool); |
false |
---|
int size = sizeof(bool); |
'nameof' 括弧
プロパティ名:
[resharper_]csharp_space_before_nameof_parentheses
, [resharper_]space_before_nameof_parentheses
使用可能な値:
true | false
例:
true |
---|
return nameof (myField); |
false |
---|
return nameof(myField); |
「新しい」括弧
プロパティ名:
[resharper_]csharp_space_before_new_parentheses
, [resharper_]space_before_new_parentheses
使用可能な値:
true | false
例:
true |
---|
List<int> x = new (); |
false |
---|
List<int> x = new(); |
キーワードと式の間
プロパティ名:
[resharper_]csharp_space_between_keyword_and_expression
, [resharper_]space_between_keyword_and_expression
使用可能な値:
true | false
例:
true |
---|
public SomeType A(object a)
{
return (SomeType)a ?? throw (new Exception());
} |
false |
---|
public SomeType A(object a)
{
return(SomeType)a ?? throw(new Exception());
} |
キーワードとタイプの間
プロパティ名:
[resharper_]csharp_space_between_keyword_and_type
, [resharper_]space_between_keyword_and_type
使用可能な値:
true | false
例:
true |
---|
public (int, int) A(ref (int, int) a)
{
return a;
} |
false |
---|
public(int, int) A(ref(int, int) a)
{
return a;
} |
ステートメントの括弧内
'if' の丸括弧
プロパティ名:
[resharper_]csharp_space_within_if_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_if_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
if ( condition )
{
foo();
} |
false |
---|
if (condition)
{
foo();
} |
'while' の丸括弧
プロパティ名:
[resharper_]csharp_space_within_while_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_while_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
while ( condition )
{
do
{
foo();
} while ( condition );
} |
false |
---|
while (condition)
{
do
{
foo();
} while (condition);
} |
'catch' の丸括弧
プロパティ名:
[resharper_]csharp_space_within_catch_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_catch_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
try
{
foo();
}
catch ( Exception e )
{
}
finally
{
} |
false |
---|
try
{
foo();
}
catch (Exception e)
{
}
finally
{
} |
'switch' の丸括弧
プロパティ名:
[resharper_]csharp_space_within_switch_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_switch_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
switch ( expression )
{
default:
break;
} |
false |
---|
switch (expression)
{
default:
break;
} |
'for' の丸括弧
プロパティ名:
[resharper_]csharp_space_within_for_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_for_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
for ( int i = 0; i < 10; i++ )
{
foo();
} |
false |
---|
for (int i = 0; i < 10; i++)
{
foo();
} |
'foreach' 括弧
プロパティ名:
[resharper_]csharp_space_within_foreach_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_foreach_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
foreach ( object o in collection )
{
foo();
} |
false |
---|
foreach (object o in collection)
{
foo();
} |
'using' 括弧
プロパティ名:
[resharper_]csharp_space_within_using_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_using_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
using ( C c = new C() )
{
foo();
} |
false |
---|
using (C c = new C())
{
foo();
} |
'lock' 括弧
プロパティ名:
[resharper_]csharp_space_within_lock_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_lock_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
lock ( this )
{
foo();
} |
false |
---|
lock (this)
{
foo();
} |
'fixed' 括弧
プロパティ名:
[resharper_]csharp_space_within_fixed_parentheses
、[resharper_]csharp_space_between_parentheses_of_control_flow_statements
、[resharper_]space_within_fixed_parentheses
、[resharper_]space_between_parentheses_of_control_flow_statements
使用可能な値:
true | false
例:
true |
---|
fixed ( int* fib = new int[1] )
{
foo();
} |
false |
---|
fixed (int* fib = new int[1])
{
foo();
} |
他の括弧内
丸括弧
プロパティ名:
[resharper_]csharp_space_within_parentheses
, [resharper_]space_within_parentheses
使用可能な値:
true | false
例:
true |
---|
a = b * ( c + d ); |
false |
---|
a = b * (c + d); |
型キャストの丸括弧
プロパティ名:
[resharper_]csharp_space_between_typecast_parentheses
, [resharper_]space_between_typecast_parentheses
使用可能な値:
true | false
例:
true |
---|
int a = ( int )b; |
false |
---|
int a = (int)b; |
メソッド宣言の丸括弧
プロパティ名:
csharp_space_between_method_declaration_parameter_list_parentheses
, [resharper_]space_between_method_declaration_parameter_list_parentheses
使用可能な値:
true | false
例:
true |
---|
class C
{
public abstract void Method1( string str );
public abstract void Method2();
} |
false |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2();
} |
メソッド宣言の空の括弧
プロパティ名:
csharp_space_between_method_declaration_empty_parameter_list_parentheses
, [resharper_]space_between_method_declaration_empty_parameter_list_parentheses
使用可能な値:
true | false
例:
true |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2( );
} |
false |
---|
class C
{
public abstract void Method1(string str);
public abstract void Method2();
} |
メソッド呼び出しの丸括弧
プロパティ名:
csharp_space_between_method_call_parameter_list_parentheses
, [resharper_]space_between_method_call_parameter_list_parentheses
使用可能な値:
true | false
例:
true |
---|
void Method()
{
foo1( "string", true );
foo2();
} |
false |
---|
void Method()
{
foo1("string", true);
foo2();
} |
空の括弧のメソッド呼び出し
プロパティ名:
csharp_space_between_method_call_empty_parameter_list_parentheses
, [resharper_]space_between_method_call_empty_parameter_list_parentheses
使用可能な値:
true | false
例:
true |
---|
void Method()
{
foo1("string", true);
foo2( );
} |
false |
---|
void Method()
{
foo1("string", true);
foo2();
} |
'typeof' 括弧
プロパティ名:
[resharper_]csharp_space_within_typeof_parentheses
, [resharper_]space_within_typeof_parentheses
使用可能な値:
true | false
例:
true |
---|
Type t = typeof( bool ); |
false |
---|
Type t = typeof(bool); |
'default' 括弧
プロパティ名:
[resharper_]csharp_space_within_default_parentheses
, [resharper_]space_within_default_parentheses
使用可能な値:
true | false
例:
true |
---|
return default( int ); |
false |
---|
return default(int); |
'checked' および 'unchecked' 括弧
プロパティ名:
[resharper_]csharp_space_within_checked_parentheses
, [resharper_]space_within_checked_parentheses
使用可能な値:
true | false
例:
true |
---|
return checked( 100000 * 10000 ) + unchecked( 10000 * 10000 ); |
false |
---|
return checked(100000 * 10000) + unchecked(10000 * 10000); |
'sizeof' 括弧
プロパティ名:
[resharper_]csharp_space_within_sizeof_parentheses
, [resharper_]space_within_sizeof_parentheses
使用可能な値:
true | false
例:
true |
---|
int size = sizeof( bool ); |
false |
---|
int size = sizeof(bool); |
'nameof' 括弧
プロパティ名:
[resharper_]csharp_space_within_nameof_parentheses
, [resharper_]space_within_nameof_parentheses
使用可能な値:
true | false
例:
true |
---|
return nameof( myField ); |
false |
---|
return nameof(myField); |
「新しい」括弧
プロパティ名:
[resharper_]csharp_space_within_new_parentheses
, [resharper_]space_within_new_parentheses
使用可能な値:
true | false
例:
true |
---|
List<int> x = new( 5 ); |
false |
---|
List<int> x = new(5); |
配列括弧周辺
配列にアクセスする前に括弧
プロパティ名:
csharp_space_before_open_square_brackets
、[resharper_]csharp_space_before_array_access_brackets
、[resharper_]space_before_array_access_brackets
、[resharper_]space_before_open_square_brackets
使用可能な値:
true | false
例:
true |
---|
array [i] = array [i + 1]; |
false |
---|
array[i] = array[i + 1]; |
配列ランク括弧の前
プロパティ名:
csharp_space_before_open_square_brackets
、[resharper_]csharp_space_before_array_rank_brackets
、[resharper_]space_before_array_rank_brackets
、[resharper_]space_before_open_square_brackets
使用可能な値:
true | false
例:
true |
---|
int [] [,] x = null; |
false |
---|
int[][,] x = null; |
配列アクセス括弧内
プロパティ名:
csharp_space_between_square_brackets
、[resharper_]csharp_space_within_array_access_brackets
、[resharper_]space_within_array_access_brackets
、[resharper_]space_between_square_brackets
使用可能な値:
true | false
例:
true |
---|
array[ i ] = array[ i + 1 ]; |
false |
---|
array[i] = array[i + 1]; |
リストパターンおよびコレクション式内括弧
プロパティ名:
csharp_space_between_square_brackets
、[resharper_]csharp_space_within_list_pattern_brackets
、[resharper_]space_within_list_pattern_brackets
、[resharper_]space_between_square_brackets
使用可能な値:
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]; |
配列ランク括弧内
プロパティ名:
csharp_space_between_square_brackets
、[resharper_]csharp_space_within_array_rank_brackets
、[resharper_]space_within_array_rank_brackets
、[resharper_]space_between_square_brackets
使用可能な値:
true | false
例:
true |
---|
int[ , ] x = new int[ 1, 2 ]; |
false |
---|
int[,] x = new int[1, 2]; |
配列ランク空括弧内
プロパティ名:
csharp_space_between_empty_square_brackets
、[resharper_]csharp_space_within_array_rank_empty_brackets
、[resharper_]space_within_array_rank_empty_brackets
、[resharper_]space_between_empty_square_brackets
使用可能な値:
true | false
例:
true |
---|
int[ ][,] x = null; |
false |
---|
int[][,] x = null; |
山括弧の周囲
型パラメーターリストの山括弧括弧を開く前に
プロパティ名:
[resharper_]csharp_space_before_type_parameter_angle
, [resharper_]space_before_type_parameter_angle
使用可能な値:
true | false
例:
true |
---|
class C <T1, T2>
{
} |
false |
---|
class C<T1, T2>
{
} |
型引数リストの山括弧括弧を開く前に
プロパティ名:
[resharper_]csharp_space_before_type_argument_angle
, [resharper_]space_before_type_argument_angle
使用可能な値:
true | false
例:
true |
---|
foo <int>(); |
false |
---|
foo<int>(); |
型パラメーター山括弧
プロパティ名:
[resharper_]csharp_space_within_type_parameter_angles
, [resharper_]space_within_type_parameter_angles
使用可能な値:
true | false
例:
true |
---|
class C< T1, T2 >
{
} |
false |
---|
class C<T1, T2>
{
} |
型引数の山括弧
プロパティ名:
[resharper_]csharp_space_within_type_argument_angles
, [resharper_]space_within_type_argument_angles
使用可能な値:
true | false
例:
true |
---|
foo< int >(); |
false |
---|
foo<int>(); |
中括弧の周囲
一行のアクセサーがブロックする前
プロパティ名:
[resharper_]csharp_space_before_singleline_accessorholder
, [resharper_]space_before_singleline_accessorholder
使用可能な値:
true | false
例:
true |
---|
int Property { get; set; } |
false |
---|
int Property{ get; set; } |
一行アクセッサ内
プロパティ名:
[resharper_]csharp_space_in_singleline_accessorholder
, [resharper_]space_in_singleline_accessorholder
使用可能な値:
true | false
例:
true |
---|
int Property
{
get { return x; }
set { x = value; }
} |
false |
---|
int Property
{
get {return x;}
set {x = value;}
} |
単一行のプロパティ / イベントのアクセサー間
プロパティ名:
[resharper_]csharp_space_between_accessors_in_singleline_property
, [resharper_]space_between_accessors_in_singleline_property
使用可能な値:
true | false
例:
true |
---|
int Property { get; set; } |
false |
---|
int Property { get;set; } |
空の波括弧間のスペース
プロパティ名:
[resharper_]csharp_space_within_empty_braces
, [resharper_]space_within_empty_braces
使用可能な値:
true | false
例:
true |
---|
class C { } |
false |
---|
class C {} |
シングルライン方式内
プロパティ名:
[resharper_]csharp_space_in_singleline_method
, [resharper_]space_in_singleline_method
使用可能な値:
true | false
例:
true |
---|
void Foo() { DoSomething(); } |
false |
---|
void Foo() {DoSomething();} |
1 行の匿名メソッド内
プロパティ名:
[resharper_]csharp_space_in_singleline_anonymous_method
, [resharper_]space_in_singleline_anonymous_method
使用可能な値:
true | false
例:
true |
---|
EventHandler e = delegate { return; }; |
false |
---|
EventHandler e = delegate {return;}; |
単一行式の中括弧内
プロパティ名:
[resharper_]csharp_space_within_single_line_array_initializer_braces
, [resharper_]space_within_single_line_array_initializer_braces
使用可能な値:
true | false
例:
true |
---|
int[] x = new int[] { 0, 1, 2 }; |
false |
---|
int[] x = new int[] {0, 1, 2}; |
二項演算子の周囲
代入演算子 (「=」や「+=」など)
プロパティ名:
[resharper_]csharp_space_around_assignment_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_assignment_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
a += 1; |
false |
---|
a+=1; |
論理演算子(&& | |)
プロパティ名:
[resharper_]csharp_space_around_logical_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_logical_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
if (a && b || c)
{
} |
false |
---|
if (a&&b||c)
{
} |
等価演算子 (==,!=)
プロパティ名:
[resharper_]csharp_space_around_equality_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_equality_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
if (a == b)
{
} |
false |
---|
if (a==b)
{
} |
比較演算子 (<、>、<=、> =)
プロパティ名:
[resharper_]csharp_space_around_relational_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_relational_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
bool condition = a < b; |
false |
---|
bool condition = a<b; |
ビット演算子(& | ,^)
プロパティ名:
[resharper_]csharp_space_around_bitwise_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_bitwise_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
int a = b ^ c; |
false |
---|
int a = b^c; |
加法演算子 (+,-)
プロパティ名:
[resharper_]csharp_space_around_additive_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_additive_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
a = a + b - c; |
false |
---|
a = a+b-c; |
乗法演算子 (*,/,%)
プロパティ名:
[resharper_]csharp_space_around_multiplicative_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_multiplicative_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
a = a * b / c; |
false |
---|
a = a*b/c; |
シフト演算子 (<<、>>、>>>)
プロパティ名:
[resharper_]csharp_space_around_shift_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_shift_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
x = x << 1; |
false |
---|
x = x<<1; |
NULL 合体演算子 (??)
プロパティ名:
[resharper_]csharp_space_around_nullcoalescing_op
、[resharper_]csharp_space_around_binary_operator
、[resharper_]space_around_nullcoalescing_op
、[resharper_]space_around_binary_operator
使用可能な値:
true | false
例:
true |
---|
x = a ?? b; |
false |
---|
x = a??b; |
安全でない矢印演算子 ( - >)
プロパティ名:
[resharper_]csharp_space_around_arrow_op
、[resharper_]csharp_space_around_member_access_operator
、[resharper_]space_around_arrow_op
、[resharper_]space_around_member_access_operator
使用可能な値:
true | false
例:
true |
---|
int b = ptr -> x; |
false |
---|
int b = ptr->x; |
単項演算子の後
論理否定演算子 (!)
プロパティ名:
[resharper_]csharp_space_after_logical_not_op
、[resharper_]csharp_space_after_unary_operator
、[resharper_]space_after_logical_not_op
、[resharper_]space_after_unary_operator
使用可能な値:
true | false
例:
true |
---|
if (! x) return; |
false |
---|
if (!x) return; |
単項負演算子 (-)
プロパティ名:
[resharper_]csharp_space_after_unary_minus_op
、[resharper_]csharp_space_after_unary_operator
、[resharper_]space_after_unary_minus_op
、[resharper_]space_after_unary_operator
使用可能な値:
true | false
例:
true |
---|
int x = - 5; |
false |
---|
int x = -5; |
単項正演算子 (+)
プロパティ名:
[resharper_]csharp_space_after_unary_plus_op
、[resharper_]csharp_space_after_unary_operator
、[resharper_]space_after_unary_plus_op
、[resharper_]space_after_unary_operator
使用可能な値:
true | false
例:
true |
---|
int x = + 5; |
false |
---|
int x = +5; |
安全でないアドレス演算子 (&)
プロパティ名:
[resharper_]csharp_space_after_ampersand_op
、[resharper_]csharp_space_after_unary_operator
、[resharper_]space_after_ampersand_op
、[resharper_]space_after_unary_operator
使用可能な値:
true | false
例:
true |
---|
int* b = & x; |
false |
---|
int* b = &x; |
安全でないアスタリスク演算子 (*)
プロパティ名:
[resharper_]csharp_space_after_asterik_op
、[resharper_]csharp_space_after_unary_operator
、[resharper_]space_after_asterik_op
、[resharper_]space_after_unary_operator
使用可能な値:
true | false
例:
true |
---|
int p = * ptr; |
false |
---|
int p = *ptr; |
前と後の ++ と -
プロパティ名:
[resharper_]csharp_space_near_postfix_and_prefix_op
, [resharper_]space_near_postfix_and_prefix_op
使用可能な値:
true | false
例:
true |
---|
void Method(int p)
{
p ++;
-- p;
} |
false |
---|
void Method(int p)
{
p++;
--p;
} |
三項演算子
'?' の前
プロパティ名:
[resharper_]csharp_space_before_ternary_quest
、[resharper_]csharp_space_around_ternary_operator
、[resharper_]space_before_ternary_quest
、[resharper_]space_around_ternary_operator
使用可能な値:
true | false
例:
true |
---|
bool b = condition ? expr1 : expr2; |
false |
---|
bool b = condition? expr1 : expr2; |
'?' の後
プロパティ名:
[resharper_]csharp_space_after_ternary_quest
、[resharper_]csharp_space_around_ternary_operator
、[resharper_]space_after_ternary_quest
、[resharper_]space_around_ternary_operator
使用可能な値:
true | false
例:
true |
---|
bool b = condition ? expr1 : expr2; |
false |
---|
bool b = condition ?expr1 : expr2; |
':' の前
プロパティ名:
[resharper_]csharp_space_before_ternary_colon
、[resharper_]csharp_space_around_ternary_operator
、[resharper_]space_before_ternary_colon
、[resharper_]space_around_ternary_operator
使用可能な値:
true | false
例:
true |
---|
bool b = condition ? expr1 : expr2; |
false |
---|
bool b = condition ? expr1: expr2; |
':' の後
プロパティ名:
[resharper_]csharp_space_after_ternary_colon
、[resharper_]csharp_space_around_ternary_operator
、[resharper_]space_after_ternary_colon
、[resharper_]space_around_ternary_operator
使用可能な値:
true | false
例:
true |
---|
bool b = condition ? expr1 : expr2; |
false |
---|
bool b = condition ? expr1 :expr2; |
コンマとセミコロンの周囲
コンマの前
プロパティ名:
csharp_space_before_comma
, [resharper_]space_before_comma
使用可能な値:
true | false
例:
true |
---|
foo(a , b , c); |
false |
---|
foo(a, b, c); |
コンマの後
プロパティ名:
csharp_space_after_comma
, [resharper_]space_after_comma
使用可能な値:
true | false
例:
true |
---|
foo(a, b, c); |
false |
---|
foo(a,b,c); |
'for' のセミコロンの前
プロパティ名:
csharp_space_before_semicolon_in_for_statement
, [resharper_]space_before_semicolon_in_for_statement
使用可能な値:
true | false
例:
true |
---|
for (int i = 1 ; i < 10 ; i++)
{
} |
false |
---|
for (int i = 1; i < 10; i++)
{
} |
'for' のセミコロンの後
プロパティ名:
csharp_space_after_semicolon_in_for_statement
, [resharper_]space_after_semicolon_in_for_statement
使用可能な値:
true | false
例:
true |
---|
for (int i = 1; i < 10; i++)
{
} |
false |
---|
for (int i = 1;i < 10;i++)
{
} |
セミコロンの前
プロパティ名:
[resharper_]csharp_space_before_semicolon
, [resharper_]space_before_semicolon
使用可能な値:
true | false
例:
true |
---|
a = b ; |
false |
---|
a = b; |
コロンの周囲
基本タイプの前にコロン
プロパティ名:
csharp_space_before_colon_in_inheritance_clause
, [resharper_]space_before_colon_in_inheritance_clause
使用可能な値:
true | false
例:
true |
---|
class Derived : BaseClass, Interface
{
} |
false |
---|
class Derived: BaseClass, Interface
{
} |
基本型の後にコロン
プロパティ名:
csharp_space_after_colon_in_inheritance_clause
, [resharper_]space_after_colon_in_inheritance_clause
使用可能な値:
true | false
例:
true |
---|
class Derived : BaseClass, Interface
{
} |
false |
---|
class Derived :BaseClass, Interface
{
} |
型パラメーターの前にコロンを入力
プロパティ名:
[resharper_]csharp_space_before_type_parameter_constraint_colon
, [resharper_]space_before_type_parameter_constraint_colon
使用可能な値:
true | false
例:
true |
---|
class C<T1> where T1 : I
{
} |
false |
---|
class C<T1> where T1: I
{
} |
型パラメーターの後にコロンを入力
プロパティ名:
[resharper_]csharp_space_after_type_parameter_constraint_colon
, [resharper_]space_after_type_parameter_constraint_colon
使用可能な値:
true | false
例:
true |
---|
class C<T1> where T1 : I
{
} |
false |
---|
class C<T1> where T1 :I
{
} |
'case' ステートメントのコロンの前
プロパティ名:
[resharper_]csharp_space_before_colon_in_case
, [resharper_]space_before_colon_in_case
使用可能な値:
true | false
例:
true |
---|
switch (expr)
{
case 0 :
break;
} |
false |
---|
switch (expr)
{
case 0:
break;
} |
'case' ステートメントのコロンの後
プロパティ名:
[resharper_]csharp_space_after_colon_in_case
, [resharper_]space_after_colon_in_case
使用可能な値:
true | false
例:
true |
---|
switch (expr)
{
case 0: return A;
case 1: return B;
} |
false |
---|
switch (expr)
{
case 0:return A;
case 1:return B;
} |
他のコロンの前
プロパティ名:
[resharper_]csharp_space_before_attribute_colon
、[resharper_]csharp_space_before_colon
、[resharper_]space_before_attribute_colon
、[resharper_]space_before_colon
使用可能な値:
true | false
例:
true |
---|
[return : Description("returns A")]
public A b()
{
Method(arg1 : 1, arg2 : 3);
var y = (tuple1 : 1, tuple2 : 2);
return null;
} |
false |
---|
[return: Description("returns A")]
public A b()
{
Method(arg1: 1, arg2: 3);
var y = (tuple1: 1, tuple2: 2);
return null;
} |
他のコロンの後
プロパティ名:
[resharper_]csharp_space_after_attribute_colon
、[resharper_]csharp_space_after_colon
、[resharper_]space_after_attribute_colon
、[resharper_]space_after_colon
使用可能な値:
true | false
例:
true |
---|
[return: Description("returns A")]
public A b()
{
Method(arg1: 1, arg2: 3);
var y = (tuple1: 1, tuple2: 2);
return null;
} |
false |
---|
[return:Description("returns A")]
public A b()
{
Method(arg1:1, arg2:3);
var y = (tuple1:1, tuple2:2);
return null;
} |
属性
属性セクション間
プロパティ名:
[resharper_]csharp_space_between_attribute_sections
, [resharper_]space_between_attribute_sections
使用可能な値:
true | false
例:
true |
---|
void Method([NotNull] [ItemNotNull] IList<string> items); |
false |
---|
void Method([NotNull][ItemNotNull] IList<string> items); |
属性括弧内
プロパティ名:
csharp_space_between_square_brackets
、[resharper_]csharp_space_within_attribute_brackets
、[resharper_]space_within_attribute_brackets
、[resharper_]space_between_square_brackets
使用可能な値:
true | false
例:
true |
---|
[ Attr1, Attr2(true) ]
class C
{
} |
false |
---|
[Attr1, Attr2(true)]
class C
{
} |
属性の後
プロパティ名:
[resharper_]csharp_space_after_attributes
, [resharper_]space_after_attributes
使用可能な値:
true | false
例:
true |
---|
void Method([NotNull] [ItemNotNull] IList<string> items); |
false |
---|
void Method([NotNull] [ItemNotNull]IList<string> items); |
その他
型キャスト括弧の後
プロパティ名:
csharp_space_after_cast
, [resharper_]space_after_cast
使用可能な値:
true | false
例:
true |
---|
int a = (int) b; |
false |
---|
int a = (int)b; |
ドット周辺
プロパティ名:
[resharper_]csharp_space_around_dot
、[resharper_]csharp_space_around_member_access_operator
、[resharper_]space_around_dot
、[resharper_]space_around_member_access_operator
使用可能な値:
true | false
例:
true |
---|
a . b . foo(); |
false |
---|
a.b.foo(); |
ラムダ矢印の周囲
プロパティ名:
[resharper_]csharp_space_around_lambda_arrow
, [resharper_]space_around_lambda_arrow
使用可能な値:
true | false
例:
true |
---|
Action a = x => x + 1; |
false |
---|
Action a = x=>x + 1; |
安全でないポインタ宣言の前
プロパティ名:
[resharper_]csharp_space_before_pointer_asterik_declaration
, [resharper_]space_before_pointer_asterik_declaration
使用可能な値:
true | false
例:
true |
---|
int * x; |
false |
---|
int* x; |
null 許容マークの前
プロパティ名:
[resharper_]csharp_space_before_nullable_mark
, [resharper_]space_before_nullable_mark
使用可能な値:
true | false
例:
true |
---|
int ? i = null; |
false |
---|
int? i = null; |
名前空間エイリアスディレクティブの '=' のまわり
プロパティ名:
[resharper_]csharp_space_around_alias_eq
, [resharper_]space_around_alias_eq
使用可能な値:
true | false
例:
true |
---|
using X = A.B; |
false |
---|
using X=A.B; |
行末コメントの前
プロパティ名:
[resharper_]csharp_space_before_trailing_comment
, [resharper_]space_before_trailing_comment
使用可能な値:
true | false
例:
true |
---|
var x = 4; // x = 4 |
false |
---|
var x = 4;// x = 4 |
オペレータのキーワードの後
プロパティ名:
[resharper_]csharp_space_after_operator_keyword
, [resharper_]space_after_operator_keyword
使用可能な値:
true | false
例:
true |
---|
public static bool operator ==(C x, C y)
{
} |
false |
---|
public static bool operator==(C x, C y)
{
} |
スライスパターンの「..」の後
プロパティ名:
[resharper_]csharp_space_within_slice_pattern
, [resharper_]space_within_slice_pattern
使用可能な値:
true | false
例:
true |
---|
bool matches = sourceObject is [1, 2, .. var tail]; |
false |
---|
bool matches = sourceObject is [1, 2, ..var tail]; |
関連ページ:
EditorConfig を使用する
ReSharper は、EditorConfig 形式で定義されたコード形式スタイル、コード構文スタイル、C# の命名スタイル、コードインスペクション重大度レベルをサポートします。Matthell は、ReSharper が EditorConfig を使用してフォーマットルールの設定全体をどのように維持するのをヘルプいるかを示しています。EditorConfig とは何ですか? ReSharper はどのようにそれを拡張しますか? :EditorConfig は、同じコードで作業しているチームメ...
C# の EditorConfig プロパティ: その他
ReSharper その他:古いフォーマットエンジンに戻すプロパティ名:, 使用可能な値:C# の EditorConfig プロパティ: 改行 C# の EditorConfig プロパティ: スペース