JetBrains Rider 2020.3 Help

C# - Tabs, Indents, Alignment

General

Indent style

Property names:

indent_style, [resharper_]csharp_indent_style

Possible values:

  • tab: Tab

  • space: Spaces

Examples:

tab
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }
space
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }

Indent size

Property names:

indent_size, [resharper_]csharp_indent_size

Possible values:

an integer

Examples:

value: 0
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }
value: 1
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }
value: 2
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }

Tab width

Property names:

tab_width, [resharper_]csharp_tab_width

Possible values:

an integer

Examples:

value: 0
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }
value: 1
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }
value: 2
if (condition) { if (condition1) { foo1(); foo2(); } else { foo3(); foo4(); } }

Continuous line indent multiplier

Property names:

[resharper_]csharp_continuous_indent_multiplier, [resharper_]continuous_indent_multiplier

Possible values:

an integer

Examples:

value: 0
int x = foo1() + foo2();
value: 1
int x = foo1() + foo2();
value: 2
int x = foo1() + foo2();

Nested statements

Indent nested "using" statements

Property names:

[resharper_]csharp_indent_nested_usings_stmt, [resharper_]indent_nested_usings_stmt

Possible values:

true | false

Examples:

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

Indent nested "fixed" statements

Property names:

[resharper_]csharp_indent_nested_fixed_stmt, [resharper_]indent_nested_fixed_stmt

Possible values:

true | false

Examples:

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

Indent nested "lock" statements

Property names:

[resharper_]csharp_indent_nested_lock_stmt, [resharper_]indent_nested_lock_stmt

Possible values:

true | false

Examples:

true
lock (a) lock (b) lock (c) { foo(); }
false
lock (a) lock (b) lock (c) { foo(); }

Indent nested "for" statements

Property names:

[resharper_]csharp_indent_nested_for_stmt, [resharper_]indent_nested_for_stmt

Possible values:

true | false

Examples:

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

Indent nested "foreach" statements

Property names:

[resharper_]csharp_indent_nested_foreach_stmt, [resharper_]indent_nested_foreach_stmt

Possible values:

true | false

Examples:

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

Indent nested "while" statements

Property names:

[resharper_]csharp_indent_nested_while_stmt, [resharper_]indent_nested_while_stmt

Possible values:

true | false

Examples:

true
while (a) while (b) while (c) { foo(); }
false
while (a) while (b) while (c) { foo(); }

Parenthesis

Use continuous line indent inside parenthesis

Property names:

[resharper_]csharp_use_continuous_indent_inside_parens, [resharper_]use_continuous_indent_inside_parens

Possible values:

true | false

Examples:

true
var x = Method( parameter1, parameter2 );
false
var x = Method( parameter1, parameter2 );

Indent method declarations' parenthesis

Property names:

[resharper_]csharp_indent_method_decl_pars, [resharper_]indent_method_decl_pars

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

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

Indent method calls' parenthesis

Property names:

[resharper_]csharp_indent_invocation_pars, [resharper_]indent_invocation_pars

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

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

Indent statement (if, while, for, etc) parenthesis

Property names:

[resharper_]csharp_indent_statement_pars, [resharper_]indent_statement_pars

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

inside
if ( condition1 && condition2 ) return;
outside
if ( condition1 && condition2 ) return;
outside_and_inside
if ( condition1 && condition2 ) return;
none
if ( condition1 && condition2 ) return;

Indent type parameter's angles

Property names:

[resharper_]csharp_indent_typeparam_angles, [resharper_]indent_typeparam_angles

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

inside
void Method< T1, T2 >();
outside
void Method< T1, T2 >();
outside_and_inside
void Method< T1, T2 >();
none
void Method< T1, T2 >();

Indent type argument's angles

Property names:

[resharper_]csharp_indent_typearg_angles, [resharper_]indent_typearg_angles

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

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

Indent other parenthesis and brackets

Property names:

[resharper_]csharp_indent_pars, [resharper_]indent_pars

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

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

Preprocessor directives

Indent #if, #else, #elif, #endif

Property names:

[resharper_]csharp_indent_preprocessor_if, [resharper_]indent_preprocessor_if

Possible values:

  • no_indent: No indent

  • usual_indent: Indent as usual

  • outdent: Outdent

  • do_not_change: Do not change

Examples:

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

Indent #region, #endregion

Property names:

[resharper_]csharp_indent_preprocessor_region, [resharper_]indent_preprocessor_region

Possible values:

  • no_indent: No indent

  • usual_indent: Indent as usual

  • outdent: Outdent

  • do_not_change: Do not change

Examples:

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

Indent other preprocessor directives

Property names:

[resharper_]csharp_indent_preprocessor_other, [resharper_]indent_preprocessor_other

Possible values:

  • no_indent: No indent

  • usual_indent: Indent as usual

  • outdent: Outdent

  • do_not_change: Do not change

Examples:

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

Other indents

Indent "case" from "switch"

Property names:

csharp_indent_switch_labels, [resharper_]indent_switch_labels

Possible values:

true | false

Examples:

true
switch (expression) { case 0: break; }
false
switch (expression) { case 0: break; }

Indent type constraints

Property names:

[resharper_]csharp_indent_type_constraints, [resharper_]indent_type_constraints

Possible values:

true | false

Examples:

true
class C1<T1> where T1 : I1 { }
false
class C1<T1> where T1 : I1 { }

Don't indent comments started at first column

Property names:

[resharper_]csharp_stick_comment, [resharper_]stick_comment

Possible values:

true | false

Examples:

Before formattingAfter formatting, true
namespace N { // Some comment class C { } }
namespace N { // Some comment class C { } }
Before formattingAfter formatting, false
namespace N { // Some comment class C { } }
namespace N { // Some comment class C { } }

Place comments at first column when commenting out code

Property names:

[resharper_]csharp_place_comments_at_first_column, [resharper_]place_comments_at_first_column

Place comments at the first column when commenting out code. Otherwise, comments will use the indentation level of the commented code.

Possible values:

true | false

Use previous element's indent on partial format

Property names:

[resharper_]csharp_use_indent_from_previous_element, [resharper_]use_indent_from_previous_element

When formatting only a part of the file, try to take the indent from elements on previous lines (previous statements/class members/etc). If turned off, the indent will be the parent element's (usually the parent block) indent plus the indent from the indent settings.

Possible values:

true | false

Align multiline constructs

How to align when tabs are used for indents

Property names:

[resharper_]csharp_alignment_tab_fill_style, [resharper_]alignment_tab_fill_style

Possible values:

  • use_spaces: Use spaces (looks aligned on any tab size)

  • use_tabs_only: Only use tabs (inaccurate)

  • optimal_fill: Mix tabs and spaces for optimal fill

Examples:

use_spaces
SomeMyMethod(param1, param2);
use_tabs_only
SomeMyMethod(param1, param2);
optimal_fill
SomeMyMethod(param1, param2);

Align even if the resulting indentation is too large

Property names:

[resharper_]csharp_allow_far_alignment, [resharper_]allow_far_alignment

Allow alignment even if construct is located too far to the right, more than 2/3 of `Hard wrap at` limit

Possible values:

true | false

Method parameters

Property names:

[resharper_]csharp_align_multiline_parameter, [resharper_]align_multiline_parameter

Possible values:

true | false

Examples:

true
void fooCall(int firstParameter, int secondParameter) { }
false
void fooCall(int firstParameter, int secondParameter) { }

List of base classes and interfaces

Property names:

[resharper_]csharp_align_multiline_extends_list, [resharper_]align_multiline_extends_list

Possible values:

true | false

Examples:

true
class C : BaseClass, SomeInterface { }
false
class C : BaseClass, SomeInterface { }

LINQ query

Property names:

[resharper_]csharp_align_linq_query, [resharper_]align_linq_query

Possible values:

true | false

Examples:

true
var q = from x in xs where x != null select x;
false
var q = from x in xs where x != null select x;

Chained binary expressions

Property names:

[resharper_]csharp_align_multiline_binary_expressions_chain, [resharper_]align_multiline_binary_expressions_chain

Possible values:

true | false

Examples:

true
var a = someOperand + operand2 + operand3 + operand4;
false
var a = someOperand + operand2 + operand3 + operand4;

Outdent binary operators

Property names:

[resharper_]csharp_outdent_binary_ops, [resharper_]outdent_binary_ops

Possible values:

true | false

Examples:

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

Chained method calls

Property names:

[resharper_]csharp_align_multiline_calls_chain, [resharper_]align_multiline_calls_chain

Possible values:

true | false

Examples:

true
MyVar.SomeMethod() .OtherMethod() .ThirdMethod();
false
MyVar.SomeMethod() .OtherMethod() .ThirdMethod();

Outdent dots in chained method calls

Property names:

[resharper_]csharp_outdent_dots, [resharper_]outdent_dots

Possible values:

true | false

Examples:

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

Array, object and collection initializer

Property names:

[resharper_]csharp_align_multiline_array_and_object_initializer, [resharper_]align_multiline_array_and_object_initializer

Possible values:

true | false

Examples:

true
StudentName student = new StudentName { FirstName = "John", LastName = "Smith", ID = 116 }
false
StudentName student = new StudentName { FirstName = "John", LastName = "Smith", ID = 116 }

Switch expressions

Property names:

[resharper_]csharp_align_multiline_switch_expression, [resharper_]align_multiline_switch_expression

Possible values:

true | false

Examples:

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 }

Property patterns

Property names:

[resharper_]csharp_align_multiline_property_pattern, [resharper_]align_multiline_property_pattern

Possible values:

true | false

Examples:

true
bool matches = sourceObject is MyType { Field1: 1, Field2: 2, };
false
bool matches = sourceObject is MyType { Field1: 1, Field2: 2, };

Anonymous method body

Property names:

[resharper_]csharp_indent_anonymous_method_block, [resharper_]indent_anonymous_method_block

Possible values:

true | false

Examples:

true
FooCall(delegate { DoSomething(); return 0; });
false
FooCall(delegate { DoSomething(); return 0; });

Call arguments by '('

Property names:

[resharper_]csharp_align_first_arg_by_paren, [resharper_]align_first_arg_by_paren

Possible values:

true | false

Examples:

true
fooCall( firstParameter, secondParameter);
false
fooCall( firstParameter, secondParameter);

Call arguments

Property names:

[resharper_]csharp_align_multiline_argument, [resharper_]align_multiline_argument

Possible values:

true | false

Examples:

true
fooCall(firstParameter, secondParameter);
false
fooCall(firstParameter, secondParameter);

Tuple components

Property names:

[resharper_]csharp_align_tuple_components, [resharper_]align_tuple_components

Possible values:

true | false

Examples:

true
var tuple = (firstParameter, secondParameter);
false
var tuple = (firstParameter, secondParameter);

Other expressions

Property names:

[resharper_]csharp_align_multiline_expression, [resharper_]align_multiline_expression

Possible values:

true | false

Examples:

true
destination = source1 ? source2 : source3
false
destination = source1 ? source2 : source3

"for" statement header

Property names:

[resharper_]csharp_align_multiline_for_stmt, [resharper_]align_multiline_for_stmt

Possible values:

true | false

Examples:

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

Multiple declarations

Property names:

[resharper_]csharp_align_multiple_declaration, [resharper_]align_multiple_declaration

Possible values:

true | false

Examples:

true
class C { private int i = 0, j = 10; }
false
class C { private int i = 0, j = 10; }

Type parameters list

Property names:

[resharper_]csharp_align_multline_type_parameter_list, [resharper_]align_multline_type_parameter_list

Possible values:

true | false

Examples:

true
class Class<T1, T2, T3> { }
false
class Class<T1, T2, T3> { }

Type parameter constraints

Property names:

[resharper_]csharp_align_multline_type_parameter_constrains, [resharper_]align_multline_type_parameter_constrains

Possible values:

true | false

Examples:

true
class C<T1, T2> where T1 : I1 where T2 : I1 { }
false
class C<T1, T2> where T1 : I1 where T2 : I1 { }

Outdent commas

Property names:

[resharper_]csharp_outdent_commas, [resharper_]outdent_commas

Possible values:

true | false

Examples:

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

Align similar code in columns

Fix column alignment in adjacent lines

Property names:

[resharper_]csharp_int_align_fix_in_adjacent, [resharper_]int_align_fix_in_adjacent

When formatting some code, also fix column alignment in adjacent lines if needed

Possible values:

true | false

Fields and constants

Property names:

[resharper_]csharp_int_align_fields, [resharper_]csharp_int_align, [resharper_]int_align_fields, [resharper_]int_align

Possible values:

true | false

Examples:

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

Properties and events

Property names:

[resharper_]csharp_int_align_properties, [resharper_]csharp_int_align, [resharper_]int_align_properties, [resharper_]int_align

Possible values:

true | false

Examples:

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

Simple methods, operators, delegates

Property names:

[resharper_]csharp_int_align_methods, [resharper_]csharp_int_align, [resharper_]int_align_methods, [resharper_]int_align

Possible values:

true | false

Examples:

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

Multiline method signature

Property names:

[resharper_]csharp_int_align_parameters, [resharper_]csharp_int_align, [resharper_]int_align_parameters, [resharper_]int_align

Possible values:

true | false

Examples:

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") { }

Variables and local constants

Property names:

[resharper_]csharp_int_align_variables, [resharper_]csharp_int_align, [resharper_]int_align_variables, [resharper_]int_align

Possible values:

true | false

Examples:

true
{ var x = 1; var xxxxx = 2; var xxx = 2; }
false
{ var x = 1; var xxxxx = 2; var xxx = 2; }

Other assignments and initializers

Property names:

[resharper_]csharp_int_align_assignments, [resharper_]csharp_int_align, [resharper_]int_align_assignments, [resharper_]int_align

Possible values:

true | false

Examples:

true
{ x = 1; xxxxx = 2; xxx = 2; }
false
{ x = 1; xxxxx = 2; xxx = 2; }

Property patterns

Property names:

[resharper_]csharp_int_align_property_patterns, [resharper_]csharp_int_align, [resharper_]int_align_property_patterns, [resharper_]int_align

Possible values:

true | false

Examples:

true
bool matches = sourceObject is MyType { FShort : 1, FieldLongLong: 2, };
false
bool matches = sourceObject is MyType { FShort: 1, FieldLongLong: 2, };

Nested ternary operators

Property names:

[resharper_]csharp_int_align_nested_ternary, [resharper_]csharp_int_align, [resharper_]int_align_nested_ternary, [resharper_]int_align

Possible values:

true | false

Examples:

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;

Invocations of the same method

Property names:

[resharper_]csharp_int_align_invocations, [resharper_]csharp_int_align, [resharper_]int_align_invocations, [resharper_]int_align

Possible values:

true | false

Examples:

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

Binary expressions

Property names:

[resharper_]csharp_int_align_binary_expressions, [resharper_]csharp_int_align, [resharper_]int_align_binary_expressions, [resharper_]int_align

Possible values:

true | false

Examples:

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

End comments

Property names:

[resharper_]csharp_int_align_comments, [resharper_]csharp_int_align, [resharper_]int_align_comments, [resharper_]int_align

Possible values:

true | false

Examples:

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 */ }

Simple switch sections

Property names:

[resharper_]csharp_int_align_switch_sections, [resharper_]csharp_int_align, [resharper_]int_align_switch_sections, [resharper_]int_align

Possible values:

true | false

Examples:

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 expressions

Property names:

[resharper_]csharp_int_align_switch_expressions, [resharper_]csharp_int_align, [resharper_]int_align_switch_expressions, [resharper_]int_align

Possible values:

true | false

Examples:

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 }
Last modified: 24 March 2021