JetBrains Rider 2021.2 Help

C# - Spaces

Preserve existing formatting

Extra spaces inside

Property names:

[resharper_]csharp_extra_spaces, [resharper_]extra_spaces

Possible values:

  • remove_all: Remove all extra spaces

  • leave_tabs: Leave extra tabs

  • leave_multiple: Leave multiple extra spaces

  • leave_all: Leave all extra spaces and tabs

Examples:

Before formatting

After formatting, 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); }

Before formatting

After formatting, 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 ) ; }

Before formatting

After formatting, 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); }

Before formatting

After formatting, 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 ) ; }

Before parentheses in statements

"if" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

if (condition) { foo(); } else { foo(); }

false

if(condition) { foo(); } else { foo(); }

"while" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

while (condition) { do { foo(); } while (condition); }

false

while(condition) { do { foo(); } while(condition); }

"catch" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

try { foo(); } catch (Exception e) { }

false

try { foo(); } catch(Exception e) { }

"switch" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

switch (expr) { case 0: break; }

false

switch(expr) { case 0: break; }

"for" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

for (int i = 0; i < 10; i++) { foo(); }

false

for(int i = 0; i < 10; i++) { foo(); }

"foreach" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

foreach (object o in collection) { foo(); }

false

foreach(object o in collection) { foo(); }

"using" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

using (C c = new C()) { foo(); }

false

using(C c = new C()) { foo(); }

"lock" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

lock (this) { foo(); }

false

lock(this) { foo(); }

"fixed" parentheses

Property names:

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

Possible values:

true | false

Examples:

true

fixed (int* fib = new int[1]) { foo(); }

false

fixed(int* fib = new int[1]) { foo(); }

Before other parentheses

Method call parentheses

Property names:

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

Possible values:

true | false

Examples:

true

void Method() { foo1 ("string", true); foo2(); }

false

void Method() { foo1("string", true); foo2(); }

Method call empty parentheses

Property names:

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

Possible values:

true | false

Examples:

true

void Method() { foo1("string", true); foo2 (); }

false

void Method() { foo1("string", true); foo2(); }

Method declaration parentheses

Property names:

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

Possible values:

true | false

Examples:

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

Method declaration empty parentheses

Property names:

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

Possible values:

true | false

Examples:

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" parentheses

Property names:

[resharper_]csharp_space_before_typeof_parentheses, [resharper_]space_before_typeof_parentheses

Possible values:

true | false

Examples:

true

Type t = typeof (bool);

false

Type t = typeof(bool);

"default" parentheses

Property names:

[resharper_]csharp_space_before_default_parentheses, [resharper_]space_before_default_parentheses

Possible values:

true | false

Examples:

true

return default (int);

false

return default(int);

"checked" and "unchecked" parentheses

Property names:

[resharper_]csharp_space_before_checked_parentheses, [resharper_]space_before_checked_parentheses

Possible values:

true | false

Examples:

true

return checked (100000 * 10000) + unchecked (10000 * 10000);

false

return checked(100000 * 10000) + unchecked(10000 * 10000);

"sizeof" parentheses

Property names:

[resharper_]csharp_space_before_sizeof_parentheses, [resharper_]space_before_sizeof_parentheses

Possible values:

true | false

Examples:

true

int size = sizeof (bool);

false

int size = sizeof(bool);

"nameof" parentheses

Property names:

[resharper_]csharp_space_before_nameof_parentheses, [resharper_]space_before_nameof_parentheses

Possible values:

true | false

Examples:

true

return nameof (myField);

false

return nameof(myField);

"new" parentheses

Property names:

[resharper_]csharp_space_before_new_parentheses, [resharper_]space_before_new_parentheses

Possible values:

true | false

Examples:

true

List<int> x = new ();

false

List<int> x = new();

Between keyword and expression

Property names:

[resharper_]csharp_space_between_keyword_and_expression, [resharper_]space_between_keyword_and_expression

Possible values:

true | false

Examples:

true

public SomeType A(object a) { return (SomeType)a ?? throw (new Exception()); }

false

public SomeType A(object a) { return(SomeType)a ?? throw(new Exception()); }

Between keyword and type

Property names:

[resharper_]csharp_space_between_keyword_and_type, [resharper_]space_between_keyword_and_type

Possible values:

true | false

Examples:

true

public (int, int) A(ref (int, int) a) { return a; }

false

public(int, int) A(ref(int, int) a) { return a; }

Within parentheses in statements

"if" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

if ( condition ) { foo(); }

false

if (condition) { foo(); }

"while" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

while ( condition ) { do { foo(); } while ( condition ); }

false

while (condition) { do { foo(); } while (condition); }

"catch" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

try { foo(); } catch ( Exception e ) { } finally { }

false

try { foo(); } catch (Exception e) { } finally { }

"switch" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

switch ( expression ) { default: break; }

false

switch (expression) { default: break; }

"for" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

for ( int i = 0; i < 10; i++ ) { foo(); }

false

for (int i = 0; i < 10; i++) { foo(); }

"foreach" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

foreach ( object o in collection ) { foo(); }

false

foreach (object o in collection) { foo(); }

"using" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

using ( C c = new C() ) { foo(); }

false

using (C c = new C()) { foo(); }

"lock" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

lock ( this ) { foo(); }

false

lock (this) { foo(); }

"fixed" parentheses

Property names:

[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

Possible values:

true | false

Examples:

true

fixed ( int* fib = new int[1] ) { foo(); }

false

fixed (int* fib = new int[1]) { foo(); }

Within other parentheses

Parentheses

Property names:

[resharper_]csharp_space_within_parentheses, [resharper_]space_within_parentheses

Possible values:

true | false

Examples:

true

a = b * ( c + d );

false

a = b * (c + d);

Type cast parentheses

Property names:

[resharper_]csharp_space_between_typecast_parentheses, [resharper_]space_between_typecast_parentheses

Possible values:

true | false

Examples:

true

int a = ( int )b;

false

int a = (int)b;

Method declaration parentheses

Property names:

csharp_space_between_method_declaration_parameter_list_parentheses, [resharper_]space_between_method_declaration_parameter_list_parentheses

Possible values:

true | false

Examples:

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

Method declaration empty parentheses

Property names:

csharp_space_between_method_declaration_empty_parameter_list_parentheses, [resharper_]space_between_method_declaration_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

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

Method call parentheses

Property names:

csharp_space_between_method_call_parameter_list_parentheses, [resharper_]space_between_method_call_parameter_list_parentheses

Possible values:

true | false

Examples:

true

void Method() { foo1( "string", true ); foo2(); }

false

void Method() { foo1("string", true); foo2(); }

Method call empty parentheses

Property names:

csharp_space_between_method_call_empty_parameter_list_parentheses, [resharper_]space_between_method_call_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

true

void Method() { foo1("string", true); foo2( ); }

false

void Method() { foo1("string", true); foo2(); }

"typeof" parentheses

Property names:

[resharper_]csharp_space_within_typeof_parentheses, [resharper_]space_within_typeof_parentheses

Possible values:

true | false

Examples:

true

Type t = typeof( bool );

false

Type t = typeof(bool);

"default" parentheses

Property names:

[resharper_]csharp_space_within_default_parentheses, [resharper_]space_within_default_parentheses

Possible values:

true | false

Examples:

true

return default( int );

false

return default(int);

"checked" and "unchecked" parentheses

Property names:

[resharper_]csharp_space_within_checked_parentheses, [resharper_]space_within_checked_parentheses

Possible values:

true | false

Examples:

true

return checked( 100000 * 10000 ) + unchecked( 10000 * 10000 );

false

return checked(100000 * 10000) + unchecked(10000 * 10000);

"sizeof" parentheses

Property names:

[resharper_]csharp_space_within_sizeof_parentheses, [resharper_]space_within_sizeof_parentheses

Possible values:

true | false

Examples:

true

int size = sizeof( bool );

false

int size = sizeof(bool);

"nameof" parentheses

Property names:

[resharper_]csharp_space_within_nameof_parentheses, [resharper_]space_within_nameof_parentheses

Possible values:

true | false

Examples:

true

return nameof( myField );

false

return nameof(myField);

"new" parentheses

Property names:

[resharper_]csharp_space_within_new_parentheses, [resharper_]space_within_new_parentheses

Possible values:

true | false

Examples:

true

List<int> x = new( 5 );

false

List<int> x = new(5);

Around array brackets

Before array access brackets

Property names:

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

Possible values:

true | false

Examples:

true

array [i] = array [i + 1];

false

array[i] = array[i + 1];

Before array rank brackets

Property names:

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

Possible values:

true | false

Examples:

true

int [] [,] x = null;

false

int[][,] x = null;

Within array access brackets

Property names:

csharp_space_between_square_brackets, [resharper_]csharp_space_within_array_access_brackets, [resharper_]space_within_array_access_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true

array[ i ] = array[ i + 1 ];

false

array[i] = array[i + 1];

Within array rank brackets

Property names:

csharp_space_between_square_brackets, [resharper_]csharp_space_within_array_rank_brackets, [resharper_]space_within_array_rank_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true

int[ , ] x = new int[ 1, 2 ];

false

int[,] x = new int[1, 2];

Within array rank empty brackets

Property names:

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

Possible values:

true | false

Examples:

true

int[ ][,] x = null;

false

int[][,] x = null;

Around angle brackets

Before type parameter list angle

Property names:

[resharper_]csharp_space_before_type_parameter_angle, [resharper_]space_before_type_parameter_angle

Possible values:

true | false

Examples:

true

class C <T1, T2> { }

false

class C<T1, T2> { }

Before type argument list angle

Property names:

[resharper_]csharp_space_before_type_argument_angle, [resharper_]space_before_type_argument_angle

Possible values:

true | false

Examples:

true

foo <int>();

false

foo<int>();

Type parameter angles

Property names:

[resharper_]csharp_space_within_type_parameter_angles, [resharper_]space_within_type_parameter_angles

Possible values:

true | false

Examples:

true

class C< T1, T2 > { }

false

class C<T1, T2> { }

Type argument angles

Property names:

[resharper_]csharp_space_within_type_argument_angles, [resharper_]space_within_type_argument_angles

Possible values:

true | false

Examples:

true

foo< int >();

false

foo<int>();

Around braces

Before single line accessors block

Property names:

[resharper_]csharp_space_before_singleline_accessorholder, [resharper_]space_before_singleline_accessorholder

Possible values:

true | false

Examples:

true

int Property { get; set; }

false

int Property{ get; set; }

Within single line accessor

Property names:

[resharper_]csharp_space_in_singleline_accessorholder, [resharper_]space_in_singleline_accessorholder

Possible values:

true | false

Examples:

true

int Property { get { return x; } set { x = value; } }

false

int Property { get {return x;} set {x = value;} }

Between accessors in single line property/event

Property names:

[resharper_]csharp_space_between_accessors_in_singleline_property, [resharper_]space_between_accessors_in_singleline_property

Possible values:

true | false

Examples:

true

int Property { get; set; }

false

int Property { get;set; }

Space between empty braces

Property names:

[resharper_]csharp_space_within_empty_braces, [resharper_]space_within_empty_braces

Possible values:

true | false

Examples:

true

class C { }

false

class C {}

Within single line method

Property names:

[resharper_]csharp_space_in_singleline_method, [resharper_]space_in_singleline_method

Possible values:

true | false

Examples:

true

void Foo() { DoSomething(); }

false

void Foo() {DoSomething();}

Within single line anonymous method

Property names:

[resharper_]csharp_space_in_singleline_anonymous_method, [resharper_]space_in_singleline_anonymous_method

Possible values:

true | false

Examples:

true

EventHandler e = delegate { return; };

false

EventHandler e = delegate {return;};

Within single-line expression braces

Property names:

[resharper_]csharp_space_within_single_line_array_initializer_braces, [resharper_]space_within_single_line_array_initializer_braces

Possible values:

true | false

Examples:

true

int[] x = new int[] { 0, 1, 2 };

false

int[] x = new int[] {0, 1, 2};

Around binary operators

Assignment operators (=,+=,...)

Property names:

[resharper_]csharp_space_around_assignment_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_assignment_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

a += 1;

false

a+=1;

Logical operators (&&,||)

Property names:

[resharper_]csharp_space_around_logical_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_logical_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

if (a && b || c) { }

false

if (a&&b||c) { }

Equality operators (==,!=)

Property names:

[resharper_]csharp_space_around_equality_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_equality_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

if (a == b) { }

false

if (a==b) { }

Relational operators (<,>,<=,>=)

Property names:

[resharper_]csharp_space_around_relational_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_relational_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

bool condition = a < b;

false

bool condition = a<b;

Bitwise operators (&,|,^)

Property names:

[resharper_]csharp_space_around_bitwise_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_bitwise_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

int a = b ^ c;

false

int a = b^c;

Additive operators (+,-)

Property names:

[resharper_]csharp_space_around_additive_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_additive_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

a = a + b - c;

false

a = a+b-c;

Multiplicative operators (*,/,%)

Property names:

[resharper_]csharp_space_around_multiplicative_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_multiplicative_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

a = a * b / c;

false

a = a*b/c;

Shift operators (<<,>>)

Property names:

[resharper_]csharp_space_around_shift_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_shift_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

x = x << 1;

false

x = x<<1;

Null coalescing operator (??)

Property names:

[resharper_]csharp_space_around_nullcoalescing_op, [resharper_]csharp_space_around_binary_operator, [resharper_]space_around_nullcoalescing_op, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true

x = a ?? b;

false

x = a??b;

Unsafe arrow operator (->)

Property names:

[resharper_]csharp_space_around_arrow_op, [resharper_]csharp_space_around_member_access_operator, [resharper_]space_around_arrow_op, [resharper_]space_around_member_access_operator

Possible values:

true | false

Examples:

true

int b = ptr -> x;

false

int b = ptr->x;

After unary operators

Logical not operator (!)

Property names:

[resharper_]csharp_space_after_logical_not_op, [resharper_]csharp_space_after_unary_operator, [resharper_]space_after_logical_not_op, [resharper_]space_after_unary_operator

Possible values:

true | false

Examples:

true

if (! x) return;

false

if (!x) return;

Unary minus operator (-)

Property names:

[resharper_]csharp_space_after_unary_minus_op, [resharper_]csharp_space_after_unary_operator, [resharper_]space_after_unary_minus_op, [resharper_]space_after_unary_operator

Possible values:

true | false

Examples:

true

int x = - 5;

false

int x = -5;

Unary plus operator (+)

Property names:

[resharper_]csharp_space_after_unary_plus_op, [resharper_]csharp_space_after_unary_operator, [resharper_]space_after_unary_plus_op, [resharper_]space_after_unary_operator

Possible values:

true | false

Examples:

true

int x = + 5;

false

int x = +5;

Unsafe addressof operator (&)

Property names:

[resharper_]csharp_space_after_ampersand_op, [resharper_]csharp_space_after_unary_operator, [resharper_]space_after_ampersand_op, [resharper_]space_after_unary_operator

Possible values:

true | false

Examples:

true

int* b = & x;

false

int* b = &x;

Unsafe asterisk operator (*)

Property names:

[resharper_]csharp_space_after_asterik_op, [resharper_]csharp_space_after_unary_operator, [resharper_]space_after_asterik_op, [resharper_]space_after_unary_operator

Possible values:

true | false

Examples:

true

int p = * ptr;

false

int p = *ptr;

Before/after ++ and --

Property names:

[resharper_]csharp_space_near_postfix_and_prefix_op, [resharper_]space_near_postfix_and_prefix_op

Possible values:

true | false

Examples:

true

void Method(int p) { p ++; -- p; }

false

void Method(int p) { p++; --p; }

In ternary operator

Before '?'

Property names:

[resharper_]csharp_space_before_ternary_quest, [resharper_]csharp_space_around_ternary_operator, [resharper_]space_before_ternary_quest, [resharper_]space_around_ternary_operator

Possible values:

true | false

Examples:

true

bool b = condition ? expr1 : expr2;

false

bool b = condition? expr1 : expr2;

After '?'

Property names:

[resharper_]csharp_space_after_ternary_quest, [resharper_]csharp_space_around_ternary_operator, [resharper_]space_after_ternary_quest, [resharper_]space_around_ternary_operator

Possible values:

true | false

Examples:

true

bool b = condition ? expr1 : expr2;

false

bool b = condition ?expr1 : expr2;

Before ':'

Property names:

[resharper_]csharp_space_before_ternary_colon, [resharper_]csharp_space_around_ternary_operator, [resharper_]space_before_ternary_colon, [resharper_]space_around_ternary_operator

Possible values:

true | false

Examples:

true

bool b = condition ? expr1 : expr2;

false

bool b = condition ? expr1: expr2;

After ':'

Property names:

[resharper_]csharp_space_after_ternary_colon, [resharper_]csharp_space_around_ternary_operator, [resharper_]space_after_ternary_colon, [resharper_]space_around_ternary_operator

Possible values:

true | false

Examples:

true

bool b = condition ? expr1 : expr2;

false

bool b = condition ? expr1 :expr2;

Around comma and semicolon

Before comma

Property names:

csharp_space_before_comma, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true

foo(a , b , c);

false

foo(a, b, c);

After comma

Property names:

csharp_space_after_comma, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true

foo(a, b, c);

false

foo(a,b,c);

Before "for" semicolon

Property names:

csharp_space_before_semicolon_in_for_statement, [resharper_]space_before_semicolon_in_for_statement

Possible values:

true | false

Examples:

true

for (int i = 1 ; i < 10 ; i++) { }

false

for (int i = 1; i < 10; i++) { }

After "for" semicolon

Property names:

csharp_space_after_semicolon_in_for_statement, [resharper_]space_after_semicolon_in_for_statement

Possible values:

true | false

Examples:

true

for (int i = 1; i < 10; i++) { }

false

for (int i = 1;i < 10;i++) { }

Before semicolon

Property names:

[resharper_]csharp_space_before_semicolon, [resharper_]space_before_semicolon

Possible values:

true | false

Examples:

true

a = b ;

false

a = b;

Around colon

Before base types list colon

Property names:

csharp_space_before_colon_in_inheritance_clause, [resharper_]space_before_colon_in_inheritance_clause

Possible values:

true | false

Examples:

true

class Derived : BaseClass, Interface { }

false

class Derived: BaseClass, Interface { }

After base types list colon

Property names:

csharp_space_after_colon_in_inheritance_clause, [resharper_]space_after_colon_in_inheritance_clause

Possible values:

true | false

Examples:

true

class Derived : BaseClass, Interface { }

false

class Derived :BaseClass, Interface { }

Before type parameter constraint colon

Property names:

[resharper_]csharp_space_before_type_parameter_constraint_colon, [resharper_]space_before_type_parameter_constraint_colon

Possible values:

true | false

Examples:

true

class C<T1> where T1 : I { }

false

class C<T1> where T1: I { }

After type parameter constraint colon

Property names:

[resharper_]csharp_space_after_type_parameter_constraint_colon, [resharper_]space_after_type_parameter_constraint_colon

Possible values:

true | false

Examples:

true

class C<T1> where T1 : I { }

false

class C<T1> where T1 :I { }

Before colon in "case" statement

Property names:

[resharper_]csharp_space_before_colon_in_case, [resharper_]space_before_colon_in_case

Possible values:

true | false

Examples:

true

switch (expr) { case 0 : break; }

false

switch (expr) { case 0: break; }

After colon in "case" statement

Property names:

[resharper_]csharp_space_after_colon_in_case, [resharper_]space_after_colon_in_case

Possible values:

true | false

Examples:

true

switch (expr) { case 0: return A; case 1: return B; }

false

switch (expr) { case 0:return A; case 1:return B; }

Before other colons

Property names:

[resharper_]csharp_space_before_attribute_colon, [resharper_]csharp_space_before_colon, [resharper_]space_before_attribute_colon, [resharper_]space_before_colon

Possible values:

true | false

Examples:

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; }

After other colons

Property names:

[resharper_]csharp_space_after_attribute_colon, [resharper_]csharp_space_after_colon, [resharper_]space_after_attribute_colon, [resharper_]space_after_colon

Possible values:

true | false

Examples:

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; }

Attributes

Between attribute sections

Property names:

[resharper_]csharp_space_between_attribute_sections, [resharper_]space_between_attribute_sections

Possible values:

true | false

Examples:

true

void Method([NotNull] [ItemNotNull] IList<string> items);

false

void Method([NotNull][ItemNotNull] IList<string> items);

Within attribute brackets

Property names:

csharp_space_between_square_brackets, [resharper_]csharp_space_within_attribute_brackets, [resharper_]space_within_attribute_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true

[ Attr1, Attr2(true) ] class C { }

false

[Attr1, Attr2(true)] class C { }

After attributes

Property names:

[resharper_]csharp_space_after_attributes, [resharper_]space_after_attributes

Possible values:

true | false

Examples:

true

void Method([NotNull] [ItemNotNull] IList<string> items);

false

void Method([NotNull] [ItemNotNull]IList<string> items);

Other

After type cast parentheses

Property names:

csharp_space_after_cast, [resharper_]space_after_cast

Possible values:

true | false

Examples:

true

int a = (int) b;

false

int a = (int)b;

Around dot

Property names:

[resharper_]csharp_space_around_dot, [resharper_]csharp_space_around_member_access_operator, [resharper_]space_around_dot, [resharper_]space_around_member_access_operator

Possible values:

true | false

Examples:

true

a . b . foo();

false

a.b.foo();

Around lambda arrow

Property names:

[resharper_]csharp_space_around_lambda_arrow, [resharper_]space_around_lambda_arrow

Possible values:

true | false

Examples:

true

Action a = x => x + 1;

false

Action a = x=>x + 1;

Before unsafe pointer declaration

Property names:

[resharper_]csharp_space_before_pointer_asterik_declaration, [resharper_]space_before_pointer_asterik_declaration

Possible values:

true | false

Examples:

true

int * x;

false

int* x;

Before nullable mark

Property names:

[resharper_]csharp_space_before_nullable_mark, [resharper_]space_before_nullable_mark

Possible values:

true | false

Examples:

true

int ? i = null;

false

int? i = null;

Around '=' in namespace alias directive

Property names:

[resharper_]csharp_space_around_alias_eq, [resharper_]space_around_alias_eq

Possible values:

true | false

Examples:

true

using X = A.B;

false

using X=A.B;

Before end of line comment

Property names:

[resharper_]csharp_space_before_trailing_comment, [resharper_]space_before_trailing_comment

Possible values:

true | false

Examples:

true

var x = 4; // x = 4

false

var x = 4;// x = 4

After operator keyword

Property names:

[resharper_]csharp_space_after_operator_keyword, [resharper_]space_after_operator_keyword

Possible values:

true | false

Examples:

true

public static bool operator ==(C x, C y) { }

false

public static bool operator==(C x, C y) { }
Last modified: 21 October 2021