ReSharper 2024.1 Help

EditorConfig properties for C#: Line Breaks

This page lists custom ReSharper EditorConfig properties that you can use to configure formatting preferences in C#, specifically, how ReSharper should add or remove line breaks before/after specific language constructs, and whether to wrap long lines exceeding the length specified by the Hard wrap at preference.

General

Keep existing line breaks

Property names:

[resharper_]csharp_keep_user_linebreaks, [resharper_]csharp_keep_existing_arrangement, [resharper_]csharp_keep_existing_linebreaks, [resharper_]keep_user_linebreaks, [resharper_]keep_existing_arrangement, [resharper_]keep_existing_linebreaks

Possible values:

true | false

Examples:

Before formatting

After formatting, true

int var = condition ? SomeFunc1() : SomeFunc2();
int var = condition ? SomeFunc1() : SomeFunc2();

Before formatting

After formatting, false

int var = condition ? SomeFunc1() : SomeFunc2();
int var = condition ? SomeFunc1() : SomeFunc2();

Hard wrap at

Property names:

max_line_length, [resharper_]csharp_max_line_length

This option (similarly to the Editorconfig's 'max_line_length') defines the desired maximum number of characters in each line. It is applied during code reformatting if 'Wrap long lines' is enabled. Line breaks are added, if possible, at the positions not exceeding the specified value, according to the language syntax and other line wrapping settings.

Possible values:

an integer

Prefer to wrap before ','

Property names:

[resharper_]csharp_wrap_before_comma, [resharper_]wrap_before_comma

Possible values:

true | false

Examples:

true

CallMethod(arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7);

false

CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7);

Prefer to wrap before '='

Property names:

[resharper_]csharp_wrap_before_eq, [resharper_]wrap_before_eq

Possible values:

true | false

Examples:

true

myObject.ImportantField += someRatherLongExpression;

false

myObject.ImportantField += someRatherLongExpression;

Special 'else if' treatment

Property names:

[resharper_]csharp_special_else_if_treatment, [resharper_]special_else_if_treatment

Possible values:

true | false

Examples:

true

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

false

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

Line feed at end of file

Property names:

insert_final_newline, [resharper_]csharp_insert_final_newline

Possible values:

true | false

Examples:

true

class A { }

false

class A { }

Arrangement of attributes

Place attribute section list on separate line if it is longer than

Property names:

[resharper_]csharp_max_attribute_length_for_same_line, [resharper_]max_attribute_length_for_same_line

Attribute sections longer than specified values would be placed on separate line

Possible values:

an integer

Keep existing arrangement of attributes

Property names:

[resharper_]csharp_keep_existing_attribute_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_attribute_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

[Attribute] class C {} [Attribute] class C1 {}
[Attribute] class C { } [Attribute] class C1 { }

Before formatting

After formatting, false

[Attribute] class C {} [Attribute] class C1 {}
[Attribute] class C { } [Attribute] class C1 { }

Place type attribute on the same line

Property names:

[resharper_]csharp_place_type_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_type_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

[Attribute] class C { } [Attribute] class C1 { // comment }

never

[Attribute] class C { } [Attribute] class C1 { // comment }

if_owner_is_single_line

[Attribute] class C { } [Attribute] class C1 { // comment }

true

[Attribute] class C { } [Attribute] class C1 { // comment }

always

[Attribute] class C { } [Attribute] class C1 { // comment }

Place method attribute on the same line

Property names:

[resharper_]csharp_place_method_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_method_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

interface I { [Attribute] void foo(); } class C { [Attribute] void foo() { // comment } }

never

interface I { [Attribute] void foo(); } class C { [Attribute] void foo() { // comment } }

if_owner_is_single_line

interface I { [Attribute] void foo(); } class C { [Attribute] void foo() { // comment } }

true

interface I { [Attribute] void foo(); } class C { [Attribute] void foo() { // comment } }

always

interface I { [Attribute] void foo(); } class C { [Attribute] void foo() { // comment } }

Place property/indexer/event attribute on the same line

Property names:

[resharper_]csharp_place_accessorholder_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_accessorholder_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

interface I { [Attribute] int Property { get; } } class C { [Attribute] int Property { get { // comment return x; } } }

never

interface I { [Attribute] int Property { get; } } class C { [Attribute] int Property { get { // comment return x; } } }

if_owner_is_single_line

interface I { [Attribute] int Property { get; } } class C { [Attribute] int Property { get { // comment return x; } } }

true

interface I { [Attribute] int Property { get; } } class C { [Attribute] int Property { get { // comment return x; } } }

always

interface I { [Attribute] int Property { get; } } class C { [Attribute] int Property { get { // comment return x; } } }

Place accessor attribute on the same line

Property names:

[resharper_]csharp_place_accessor_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_accessor_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

interface I { int Property { [Attribute] get; } } class C { int Property { [Attribute] get { return x; } [Attribute] set { x = value; NotifySomething(); } } }

never

interface I { int Property { [Attribute] get; } } class C { int Property { [Attribute] get { return x; } [Attribute] set { x = value; NotifySomething(); } } }

if_owner_is_single_line

interface I { int Property { [Attribute] get; } } class C { int Property { [Attribute] get { return x; } [Attribute] set { x = value; NotifySomething(); } } }

true

interface I { int Property { [Attribute] get; } } class C { int Property { [Attribute] get { return x; } [Attribute] set { x = value; NotifySomething(); } } }

always

interface I { int Property { [Attribute] get; } } class C { int Property { [Attribute] get { return x; } [Attribute] set { x = value; NotifySomething(); } } }

Place field attribute on the same line

Property names:

[resharper_]csharp_place_field_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_field_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

class C { [Attribute] int x; [Attribute] MyObj y = // comment new MyObj(); }

never

class C { [Attribute] int x; [Attribute] MyObj y = // comment new MyObj(); }

if_owner_is_single_line

class C { [Attribute] int x; [Attribute] MyObj y = // comment new MyObj(); }

true

class C { [Attribute] int x; [Attribute] MyObj y = // comment new MyObj(); }

always

class C { [Attribute] int x; [Attribute] MyObj y = // comment new MyObj(); }

Place record field attribute on the same line

Property names:

[resharper_]csharp_place_record_field_attribute_on_same_line, [resharper_]csharp_place_attribute_on_same_line, [resharper_]place_record_field_attribute_on_same_line, [resharper_]place_attribute_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

record MyRecord( [Attribute] int Field);

never

record MyRecord( [Attribute] int Field);

if_owner_is_single_line

record MyRecord([Attribute] int Field);

true

record MyRecord([Attribute] int Field);

always

record MyRecord([Attribute] int Field);

Arrangement of method signatures

Wrap formal parameters

Property names:

[resharper_]csharp_wrap_parameters_style, [resharper_]wrap_parameters_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

interface IA { void M(int p1, int p2); void SomeMethod(int p1, int p2, int p3, int p4); }

chop_if_long

interface IA { void M(int p1, int p2); void SomeMethod(int p1, int p2, int p3, int p4); }

chop_always

interface IA { void M(int p1, int p2); void SomeMethod(int p1, int p2, int p3, int p4); }

Max formal parameters on a single line

Property names:

[resharper_]csharp_max_formal_parameters_on_line, [resharper_]max_formal_parameters_on_line

Possible values:

an integer

Examples:

value: 0

interface IA { void M(int arg1); void M(int arg1, int arg2); void M(int arg1, int arg2, int arg3); void M(int arg1, int arg2, int arg3, int arg4); void M(int arg1, int arg2, int arg3, int arg4, int arg5); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); }

value: 1

interface IA { void M(int arg1); void M(int arg1, int arg2); void M(int arg1, int arg2, int arg3); void M(int arg1, int arg2, int arg3, int arg4); void M(int arg1, int arg2, int arg3, int arg4, int arg5); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); }

value: 2

interface IA { void M(int arg1); void M(int arg1, int arg2); void M(int arg1, int arg2, int arg3); void M(int arg1, int arg2, int arg3, int arg4); void M(int arg1, int arg2, int arg3, int arg4, int arg5); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8); void M(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); }

Keep existing arrangement of parenthesis in declaration

Property names:

[resharper_]csharp_keep_existing_declaration_parens_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_declaration_parens_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

void SomeMethod ( int p1, int p2, int p3, int p4 ) {}
void SomeMethod ( int p1, int p2, int p3, int p4 ) { }

Before formatting

After formatting, false

void SomeMethod ( int p1, int p2, int p3, int p4 ) {}
void SomeMethod(int p1, int p2, int p3, int p4) { }

Prefer to wrap before '(' in declaration

Property names:

[resharper_]csharp_wrap_before_declaration_lpar, [resharper_]wrap_before_declaration_lpar

Possible values:

true | false

Examples:

true

void SomeMethod (int p1, int p2, int p3, int p4) { }

false

void SomeMethod(int p1, int p2, int p3, int p4) { }

Prefer to wrap after '(' in declaration

Property names:

[resharper_]csharp_wrap_after_declaration_lpar, [resharper_]wrap_after_declaration_lpar

Possible values:

true | false

Examples:

true

void SomeMethod( int p1, int p2, int p3, int p4) { }

false

void SomeMethod(int p1, int p2, int p3, int p4) { }

Prefer to wrap before ')' in declaration

Property names:

[resharper_]csharp_wrap_before_declaration_rpar, [resharper_]wrap_before_declaration_rpar

Possible values:

true | false

Examples:

true

void SomeMethod(int p1, int p2, int p3, int p4 ) { }

false

void SomeMethod(int p1, int p2, int p3, int p4) { }

Allow constructor initializer on the same line

Property names:

[resharper_]csharp_place_constructor_initializer_on_same_line, [resharper_]place_constructor_initializer_on_same_line

Possible values:

true | false

Examples:

true

class C { public C() : base() { } }

false

class C { public C() : base() { } }

Arrangement of primary constructor signatures

Wrap primary constructor parameters

Property names:

[resharper_]csharp_wrap_primary_constructor_parameters_style, [resharper_]wrap_primary_constructor_parameters_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

chop_if_long

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

chop_always

public record Person( string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

Max primary constructor parameters on a single line

Property names:

[resharper_]csharp_max_primary_constructor_parameters_on_line, [resharper_]max_primary_constructor_parameters_on_line

Possible values:

an integer

Examples:

value: 0

public record Person( string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

value: 1

public record Person( string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

value: 2

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

Keep existing arrangement of parenthesis in declaration

Property names:

[resharper_]csharp_keep_existing_primary_constructor_declaration_parens_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_primary_constructor_declaration_parens_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type ) : IParameter;
public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type ) : IParameter;

Before formatting

After formatting, false

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type ) : IParameter;
public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

Prefer to wrap before '(' in declaration

Property names:

[resharper_]csharp_wrap_before_primary_constructor_declaration_lpar, [resharper_]wrap_before_primary_constructor_declaration_lpar

Possible values:

true | false

Examples:

true

public record Person(string Name, int Age); public partial class Parameter ( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

false

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

Prefer to wrap after '(' in declaration

Property names:

[resharper_]csharp_wrap_after_primary_constructor_declaration_lpar, [resharper_]wrap_after_primary_constructor_declaration_lpar

Possible values:

true | false

Examples:

true

public record Person(string Name, int Age); public partial class Parameter( string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

false

public record Person(string Name, int Age); public partial class Parameter(string name, IParametersOwner owner, int parameterIndex, ParameterKind kind, ScopedKind parameterScope, IType type) : IParameter;

Prefer to wrap before ')' in declaration

Property names:

[resharper_]csharp_wrap_before_primary_constructor_declaration_rpar, [resharper_]wrap_before_primary_constructor_declaration_rpar

Possible values:

true | false

Examples:

true

public record Person(string Name, int Age); public partial class Parameter( string name, int parameterIndex, ParameterKind kind, IType type ) : IParameter;

false

public record Person(string Name, int Age); public partial class Parameter( string name, int parameterIndex, ParameterKind kind, IType type) : IParameter;

Arrangement of expression bodied members

Keep existing arrangement of expression bodied members

Property names:

[resharper_]csharp_keep_existing_expr_member_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_expr_member_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

class A { public int Foo() => 0; public int Foo1() => 1; public int Foo2() => 2; }
class A { public int Foo() => 0; public int Foo1() => 1; public int Foo2() => 2; }

Before formatting

After formatting, false

class A { public int Foo() => 0; public int Foo1() => 1; public int Foo2() => 2; }
class A { public int Foo() => 0; public int Foo1() => 1; public int Foo2() => 2; }

Place method expression body on the same line

Property names:

[resharper_]csharp_place_expr_method_on_single_line, [resharper_]place_expr_method_on_single_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

class A { public int Foo() => 0; public int // comment Foo1() => 1; public int Foo2() => 1 + // comment 2; }

never

class A { public int Foo() => 0; public int // comment Foo1() => 1; public int Foo2() => 1 + // comment 2; }

if_owner_is_single_line

class A { public int Foo() => 0; public int // comment Foo1() => 1; public int Foo2() => 1 + // comment 2; }

true

class A { public int Foo() => 0; public int // comment Foo1() => 1; public int Foo2() => 1 + // comment 2; }

always

class A { public int Foo() => 0; public int // comment Foo1() => 1; public int Foo2() => 1 + // comment 2; }

Place property expression body on the same line

Property names:

[resharper_]csharp_place_expr_property_on_single_line, [resharper_]place_expr_property_on_single_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

class A { public int Foo => 0; public int // comment Foo1 => 1; public int Foo2 => 1 + // comment 2; }

never

class A { public int Foo => 0; public int // comment Foo1 => 1; public int Foo2 => 1 + // comment 2; }

if_owner_is_single_line

class A { public int Foo => 0; public int // comment Foo1 => 1; public int Foo2 => 1 + // comment 2; }

true

class A { public int Foo => 0; public int // comment Foo1 => 1; public int Foo2 => 1 + // comment 2; }

always

class A { public int Foo => 0; public int // comment Foo1 => 1; public int Foo2 => 1 + // comment 2; }

Place property accessor expression body on the same line

Property names:

[resharper_]csharp_place_expr_accessor_on_single_line, [resharper_]place_expr_accessor_on_single_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

class A { public int Foo { get => 0; } public int Foo1 { get => 1 + // comment 2; } }

never

class A { public int Foo { get => 0; } public int Foo1 { get => 1 + // comment 2; } }

if_owner_is_single_line

class A { public int Foo { get => 0; } public int Foo1 { get => 1 + // comment 2; } }

true

class A { public int Foo { get => 0; } public int Foo1 { get => 1 + // comment 2; } }

always

class A { public int Foo { get => 0; } public int Foo1 { get => 1 + // comment 2; } }

Prefer to wrap before '=>' followed by expressions

Property names:

[resharper_]csharp_wrap_before_arrow_with_expressions, [resharper_]wrap_before_arrow_with_expressions

Possible values:

true | false

Examples:

true

class A { public int Foo(int y) => Br(y * y + y << y + y); Func<int, int, int> Method2() { return (xxx, yyy) => Br(xxx * yyy); } }

false

class A { public int Foo(int y) => Br(y * y + y << y + y); Func<int, int, int> Method2() { return (xxx, yyy) => Br(xxx * yyy); } }

Arrangement of type parameters, constraints, and base types

Allow type constraints on the same line

Property names:

[resharper_]csharp_place_type_constraints_on_same_line, [resharper_]place_type_constraints_on_same_line

Possible values:

true | false

Examples:

true

class C<T> where T : IEnumerable { }

false

class C<T> where T : IEnumerable { }

Prefer to wrap before first constraint

Property names:

[resharper_]csharp_wrap_before_first_type_parameter_constraint, [resharper_]wrap_before_first_type_parameter_constraint

Possible values:

true | false

Examples:

true

class C<T1, T2, T3> where T1 : I1 where T2 : new() where T3 : class

false

class C<T1, T2, T3> where T1 : I1 where T2 : new() where T3 : class

Wrap multiple type parameter constraints

Property names:

[resharper_]csharp_wrap_multiple_type_parameter_constraints_style, [resharper_]wrap_multiple_type_parameter_constraints_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

class C<T1, T2, T3> where T1 : I1 where T2 : new() where T3 : class

chop_if_long

class C<T1, T2, T3> where T1 : I1 where T2 : new() where T3 : class

chop_always

class C<T1, T2, T3> where T1 : I1 where T2 : new() where T3 : class

Prefer to wrap before opening angle bracket in type parameters list

Property names:

[resharper_]csharp_wrap_before_type_parameter_langle, [resharper_]wrap_before_type_parameter_langle

Possible values:

true | false

Examples:

true

class C <Type1, Type2, Type3, Type4> { }

false

class C<Type1, Type2, Type3, Type4> { }

Prefer to wrap before ':'

Property names:

[resharper_]csharp_wrap_before_extends_colon, [resharper_]wrap_before_extends_colon

Possible values:

true | false

Examples:

true

class Derived : BaseClass, I1, I2, I3, I4 { }

false

class Derived : BaseClass, I1, I2, I3, I4 { }

Wrap extends/implements list

Property names:

[resharper_]csharp_wrap_extends_list_style, [resharper_]wrap_extends_list_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

class Derived : BaseClass, I1, I2, I3, I4 { }

chop_if_long

class Derived : BaseClass, I1, I2, I3, I4 { }

chop_always

class Derived : BaseClass, I1, I2, I3, I4 { }

Arrangement of declaration blocks

Keep existing arrangement of declaration blocks

Property names:

[resharper_]csharp_keep_existing_declaration_block_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_declaration_block_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

interface I{ int Property { get; set; } } interface I{int Property{get;set;}}
interface I { int Property { get; set; } } interface I { int Property { get; set; } }

Before formatting

After formatting, false

interface I{ int Property { get; set; } } interface I{int Property{get;set;}}
interface I { int Property { get; set; } } interface I { int Property { get; set; } }

Place abstract/auto property/indexer/event declaration on single line

Property names:

[resharper_]csharp_place_abstract_accessorholder_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_abstract_accessorholder_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

interface I { int Property { get; set; } }

false

interface I { int Property { get; set; } }

Place simple property/indexer/event declaration on single line

Property names:

[resharper_]csharp_place_simple_accessorholder_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_simple_accessorholder_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

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

false

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

Place it on single line even when it has attributes on accessors

Property names:

[resharper_]csharp_place_accessor_with_attrs_holder_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_accessor_with_attrs_holder_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

class C { int Property { [Attr] get { return x; } [Attr] set { x = value; } } }

false

class C { int Property { [Attr] get { return x; } [Attr] set { x = value; } } }

Place simple accessor on single line

Property names:

[resharper_]csharp_place_simple_accessor_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_simple_accessor_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

class C { int Property { get { return x; } set { if (value == null) throw new Exception(); } } }

false

class C { int Property { get { return x; } set { if (value == null) throw new Exception(); } } }

Place simple method on single line

Property names:

[resharper_]csharp_place_simple_method_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_simple_method_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

class C { void Foo() { DoSomethingSimple(); } }

false

class C { void Foo() { DoSomethingSimple(); } }

Arrangement of enumerations

Keep existing arrangement of enumeration

Property names:

[resharper_]csharp_keep_existing_enum_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_enum_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

public enum Enum1 { a, b, c } public enum Enum2 { a, b, c } public enum Enum3 { a, b, c, d }
public enum Enum1 { a, b, c } public enum Enum2 { a, b, c } public enum Enum3 { a, b, c, d }

Before formatting

After formatting, false

public enum Enum1 { a, b, c } public enum Enum2 { a, b, c } public enum Enum3 { a, b, c, d }
public enum Enum1 { a, b, c } public enum Enum2 { a, b, c } public enum Enum3 { a, b, c, d }

Max enumeration members on a single line

Property names:

[resharper_]csharp_max_enum_members_on_line, [resharper_]max_enum_members_on_line

Possible values:

an integer

Examples:

value: 0

public enum Enum1 { val1 } public enum Enum2 { val1, val2 } public enum Enum3 { val1, val2, val3 } public enum Enum4 { val1, val2, val3, val4 } public enum Enum5 { val1, val2, val3, val4, val5 } public enum Enum6 { val1, val2, val3, val4, val5, val6 } public enum Enum7 { val1, val2, val3, val4, val5, val6, val7 } public enum Enum8 { val1, val2, val3, val4, val5, val6, val7, val8 } public enum Enum9 { val1, val2, val3, val4, val5, val6, val7, val8, val9 }

value: 1

public enum Enum1 { val1 } public enum Enum2 { val1, val2 } public enum Enum3 { val1, val2, val3 } public enum Enum4 { val1, val2, val3, val4 } public enum Enum5 { val1, val2, val3, val4, val5 } public enum Enum6 { val1, val2, val3, val4, val5, val6 } public enum Enum7 { val1, val2, val3, val4, val5, val6, val7 } public enum Enum8 { val1, val2, val3, val4, val5, val6, val7, val8 } public enum Enum9 { val1, val2, val3, val4, val5, val6, val7, val8, val9 }

value: 2

public enum Enum1 { val1 } public enum Enum2 { val1, val2 } public enum Enum3 { val1, val2, val3 } public enum Enum4 { val1, val2, val3, val4 } public enum Enum5 { val1, val2, val3, val4, val5 } public enum Enum6 { val1, val2, val3, val4, val5, val6 } public enum Enum7 { val1, val2, val3, val4, val5, val6, val7 } public enum Enum8 { val1, val2, val3, val4, val5, val6, val7, val8 } public enum Enum9 { val1, val2, val3, val4, val5, val6, val7, val8, val9 }

Place simple enumeration on single line

Property names:

[resharper_]csharp_place_simple_enum_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]csharp_place_simple_declaration_blocks_on_single_line, [resharper_]place_simple_enum_on_single_line, [resharper_]place_simple_blocks_on_single_line, [resharper_]place_simple_declaration_blocks_on_single_line

Possible values:

true | false

Examples:

true

public enum Enum1 { a, b, c }

false

public enum Enum1 { a, b, c }

Wrap enumeration declaration

Property names:

[resharper_]csharp_wrap_enum_declaration, [resharper_]wrap_enum_declaration

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

public enum Enum1 { a, b, c } public enum Enum2 { aaaaa, bbbbb, ccccc, ddddd, eeeee, fffff }

chop_if_long

public enum Enum1 { a, b, c } public enum Enum2 { aaaaa, bbbbb, ccccc, ddddd, eeeee, fffff }

chop_always

public enum Enum1 { a, b, c } public enum Enum2 { aaaaa, bbbbb, ccccc, ddddd, eeeee, fffff }

Arrangement of statements

Place 'else' on a new line

Property names:

csharp_new_line_before_else, [resharper_]new_line_before_else

Possible values:

true | false

Examples:

true

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

false

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

Place 'while' on a new line

Property names:

[resharper_]csharp_new_line_before_while, [resharper_]new_line_before_while

Possible values:

true | false

Examples:

true

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

false

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

Place 'catch' on a new line

Property names:

csharp_new_line_before_catch, [resharper_]new_line_before_catch

Possible values:

true | false

Examples:

true

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

false

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

Place 'finally' on a new line

Property names:

csharp_new_line_before_finally, [resharper_]new_line_before_finally

Possible values:

true | false

Examples:

true

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

false

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

Wrap 'for' statement header

Property names:

[resharper_]csharp_wrap_for_stmt_header_style, [resharper_]wrap_for_stmt_header_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

for (int i = initial; i < loopLimit; i++) { }

chop_if_long

for (int i = initial; i < loopLimit; i++) { }

chop_always

for (int i = initial; i < loopLimit; i++) { }

Wrap multiple declaration

Property names:

[resharper_]csharp_wrap_multiple_declaration_style, [resharper_]wrap_multiple_declaration_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

class C { public int i = 0, j = 0, k = 2, l = 3, m = 4, n = 5; }

chop_if_long

class C { public int i = 0, j = 0, k = 2, l = 3, m = 4, n = 5; }

chop_always

class C { public int i = 0, j = 0, k = 2, l = 3, m = 4, n = 5; }

Arrangement of embedded statements

Keep existing arrangement of embedded statements

Property names:

[resharper_]csharp_keep_existing_embedded_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_embedded_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

{ if (condition) DoSomething(); if (condition1) DoSomething1(); }
{ if (condition) DoSomething(); if (condition1) DoSomething1(); }

Before formatting

After formatting, false

{ if (condition) DoSomething(); if (condition1) DoSomething1(); }
{ if (condition) DoSomething(); if (condition1) DoSomething1(); }

Place simple embedded statement on the same line

Property names:

[resharper_]csharp_place_simple_embedded_statement_on_same_line, [resharper_]place_simple_embedded_statement_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

{ if (condition) DoSomething(); if (condition && // comment condition1) DoSomething(); }

never

{ if (condition) DoSomething(); if (condition && // comment condition1) DoSomething(); }

if_owner_is_single_line

{ if (condition) DoSomething(); if (condition && // comment condition1) DoSomething(); }

true

{ if (condition) DoSomething(); if (condition && // comment condition1) DoSomething(); }

always

{ if (condition) DoSomething(); if (condition && // comment condition1) DoSomething(); }

Place simple 'case' statement on the same line

Property names:

[resharper_]csharp_place_simple_case_statement_on_same_line, [resharper_]place_simple_case_statement_on_same_line

Possible values:

  • false: Never

  • never: Never

  • if_owner_is_single_line: If owner is singleline

  • true: Always

  • always: Always

Examples:

false

switch (foo) { case 1: return a; case 2: case 3: return a; }

never

switch (foo) { case 1: return a; case 2: case 3: return a; }

if_owner_is_single_line

switch (foo) { case 1: return a; case 2: case 3: return a; }

true

switch (foo) { case 1: return a; case 2: case 3: return a; }

always

switch (foo) { case 1: return a; case 2: case 3: return a; }

Arrangement of embedded blocks

Keep existing arrangement of embedded blocks

Property names:

[resharper_]csharp_keep_existing_embedded_block_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_embedded_block_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

{ if (condition) { DoSomething(); } if (condition1) { DoSomething1(); } }
{ if (condition) { DoSomething(); } if (condition1) { DoSomething1(); } }

Before formatting

After formatting, false

{ if (condition) { DoSomething(); } if (condition1) { DoSomething1(); } }
{ if (condition) { DoSomething(); } if (condition1) { DoSomething1(); } }

Place a block with a single simple statement on the same line

Property names:

[resharper_]csharp_place_simple_embedded_block_on_same_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]place_simple_embedded_block_on_same_line, [resharper_]place_simple_blocks_on_single_line

Possible values:

true | false

Examples:

true

if (condition) { DoSomething(); }

false

if (condition) { DoSomething(); }

Place simple anonymous method on single line

Property names:

[resharper_]csharp_place_simple_anonymousmethod_on_single_line, [resharper_]csharp_place_simple_blocks_on_single_line, [resharper_]place_simple_anonymousmethod_on_single_line, [resharper_]place_simple_blocks_on_single_line

Possible values:

true | false

Examples:

true

EventHandler e = delegate { return; };

false

EventHandler e = delegate { return; };

Arrangement of switch expressions

Keep existing arrangement of switch expressions

Property names:

[resharper_]csharp_keep_existing_switch_expression_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_switch_expression_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

{ var result = x switch { T.A => 0, T.B => 1 }; var result = x switch { T.A => 0, T.B => 1 }; }
{ var result = x switch { T.A => 0, T.B => 1 }; var result = x switch { T.A => 0, T.B => 1 }; }

Before formatting

After formatting, false

{ var result = x switch { T.A => 0, T.B => 1 }; var result = x switch { T.A => 0, T.B => 1 }; }
{ var result = x switch { T.A => 0, T.B => 1 }; var result = x switch { T.A => 0, T.B => 1 }; }

Place simple switch expression on single line

Property names:

[resharper_]csharp_place_simple_switch_expression_on_single_line, [resharper_]place_simple_switch_expression_on_single_line

Possible values:

true | false

Examples:

true

var result = x switch { T.A => 0, T.B => 1 };

false

var result = x switch { T.A => 0, T.B => 1 };

Wrap switch expression

Property names:

[resharper_]csharp_wrap_switch_expression, [resharper_]wrap_switch_expression

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

(x switch { T.A => 0, T.B => 1, T.C => 2 }) + (x switch { T.A => 0, T.B => 1 + 2, T.C => 2 })

chop_if_long

(x switch { T.A => 0, T.B => 1, T.C => 2 }) + (x switch { T.A => 0, T.B => 1 + 2, T.C => 2 })

chop_always

(x switch { T.A => 0, T.B => 1, T.C => 2 }) + (x switch { T.A => 0, T.B => 1 + 2, T.C => 2 })

Arrangement of property patterns

Keep existing arrangement of property patterns

Property names:

[resharper_]csharp_keep_existing_property_patterns_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_property_patterns_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2 };
bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2 };

Before formatting

After formatting, false

bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2 };
bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2 };

Place simple property pattern on single line

Property names:

[resharper_]csharp_place_simple_property_pattern_on_single_line, [resharper_]place_simple_property_pattern_on_single_line

Possible values:

true | false

Examples:

true

bool matches = sourceObject is MyType { F1: 1, F2: 2 };

false

bool matches = sourceObject is MyType { F1: 1, F2: 2 };

Wrap property pattern

Property names:

[resharper_]csharp_wrap_property_pattern, [resharper_]wrap_property_pattern

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2, F3: 3, F4: 4, F5: 5, F6: 6, F7: 7, F8: 8 };

chop_if_long

bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2, F3: 3, F4: 4, F5: 5, F6: 6, F7: 7, F8: 8 };

chop_always

bool matches = sourceObject is MyType { F1: 1, F2: 2 } && sourceObject is MyType { F1: 1, F2: 2, F3: 3, F4: 4, F5: 5, F6: 6, F7: 7, F8: 8 };

Arrangement of list patterns

Keep existing arrangement of list patterns and collection expressions

Property names:

[resharper_]csharp_keep_existing_list_patterns_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_list_patterns_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

true

int[] collection = [ 1, 2, 3, 4, 5, 6 ]; var otherCollection = [1, 2, 3, 4, 5, 6]; var matches = collection is [ 1, > 0, not 42, 4, 5, 6 ]; var otherMatches = otherCollection is [1, 2, 3, 4, 5, 6];

false

int[] collection = [1, 2, 3, 4, 5, 6]; var otherCollection = [1, 2, 3, 4, 5, 6]; var matches = collection is [1, > 0, not 42, 4, 5, 6]; var otherMatches = otherCollection is [1, 2, 3, 4, 5, 6];

Place simple list pattern and collection expression on a single line

Property names:

[resharper_]csharp_place_simple_list_pattern_on_single_line, [resharper_]place_simple_list_pattern_on_single_line

Possible values:

true | false

Examples:

true

int[] collection = [1, 2, 3, 4, 5, 6, 7, 8]; var matches = collection is [1, > 0, not 42, 4, 5, 6, 7, 8];

false

int[] collection = [ 1, 2, 3, 4, 5, 6, 7, 8 ]; var matches = collection is [ 1, > 0, not 42, 4, 5, 6, 7, 8 ];

Wrap list pattern and collection expression

Property names:

[resharper_]csharp_wrap_list_pattern, [resharper_]wrap_list_pattern

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

int[] collection = [ Element1, Element2, Element3, Element4, Element5, Element6, Element7 ]; var matches = collection is [ 1, 2, > 0, 4, 5, 6, not 42, 8, 9, 10, 11, 12, 13 ];

chop_if_long

int[] collection = [ Element1, Element2, Element3, Element4, Element5, Element6, Element7 ]; var matches = collection is [ 1, 2, > 0, 4, 5, 6, not 42, 8, 9, 10, 11, 12, 13 ];

chop_always

int[] collection = [ Element1, Element2, Element3, Element4, Element5, Element6, Element7 ]; var matches = collection is [ 1, 2, > 0, 4, 5, 6, not 42, 8, 9, 10, 11, 12, 13 ];

Arrangement of initializers

Keep existing arrangement of initializers

Property names:

[resharper_]csharp_keep_existing_initializer_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_initializer_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

{ var result = new { A = 0 }; var result = new { A = 0 }; }
{ var result = new { A = 0 }; var result = new { A = 0 }; }

Before formatting

After formatting, false

{ var result = new { A = 0 }; var result = new { A = 0 }; }
{ var result = new { A = 0 }; var result = new { A = 0 }; }

Place simple array, object and collection on single line

Property names:

[resharper_]csharp_place_simple_initializer_on_single_line, [resharper_]place_simple_initializer_on_single_line

Possible values:

true | false

Examples:

true

var result = new { A = 0 };

false

var result = new { A = 0 };

Max object and collection initializer elements on a single line

Property names:

[resharper_]csharp_max_initializer_elements_on_line, [resharper_]max_initializer_elements_on_line

Possible values:

an integer

Examples:

value: 0

{ x = new C() { Prop1 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1, Prop9 = 1 }; }

value: 1

{ x = new C() { Prop1 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1, Prop9 = 1 }; }

value: 2

{ x = new C() { Prop1 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1 }; x = new C() { Prop1 = 1, Prop2 = 1, Prop3 = 1, Prop4 = 1, Prop5 = 1, Prop6 = 1, Prop7 = 1, Prop8 = 1, Prop9 = 1 }; }

Wrap object and collection initializer

Property names:

[resharper_]csharp_wrap_object_and_collection_initializer_style, [resharper_]wrap_object_and_collection_initializer_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

new C() { PropertyX = 1, PropertyY = 2, PropertyZ = 3 }

chop_if_long

new C() { PropertyX = 1, PropertyY = 2, PropertyZ = 3 }

chop_always

new C() { PropertyX = 1, PropertyY = 2, PropertyZ = 3 }

Max array initializer and collection expression elements on a single line

Property names:

[resharper_]csharp_max_array_initializer_elements_on_line, [resharper_]max_array_initializer_elements_on_line

Possible values:

an integer

Examples:

value: 0

{ x = new[] { val1 }; x = new[] { val1, val2 }; x = new[] { val1, val2, val3 }; x = new[] { val1, val2, val3, val4 }; x = new[] { val1, val2, val3, val4, val5 }; x = new[] { val1, val2, val3, val4, val5, val6 }; x = new[] { val1, val2, val3, val4, val5, val6, val7 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8, val9 }; }

value: 1

{ x = new[] { val1 }; x = new[] { val1, val2 }; x = new[] { val1, val2, val3 }; x = new[] { val1, val2, val3, val4 }; x = new[] { val1, val2, val3, val4, val5 }; x = new[] { val1, val2, val3, val4, val5, val6 }; x = new[] { val1, val2, val3, val4, val5, val6, val7 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8, val9 }; }

value: 2

{ x = new[] { val1 }; x = new[] { val1, val2 }; x = new[] { val1, val2, val3 }; x = new[] { val1, val2, val3, val4 }; x = new[] { val1, val2, val3, val4, val5 }; x = new[] { val1, val2, val3, val4, val5, val6 }; x = new[] { val1, val2, val3, val4, val5, val6, val7 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8 }; x = new[] { val1, val2, val3, val4, val5, val6, val7, val8, val9 }; }

Wrap array initializer

Property names:

[resharper_]csharp_wrap_array_initializer_style, [resharper_]wrap_array_initializer_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

new C[] { Element1, ElementX, ElementY, ElementZ, ElementZzz }

chop_if_long

new C[] { Element1, ElementX, ElementY, ElementZ, ElementZzz }

chop_always

new C[] { Element1, ElementX, ElementY, ElementZ, ElementZzz }

Arrangement of invocations

Wrap invocation arguments

Property names:

[resharper_]csharp_wrap_arguments_style, [resharper_]wrap_arguments_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

{ CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3, arg4, arg5); }

chop_if_long

{ CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3, arg4, arg5); }

chop_always

{ CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3, arg4, arg5); }

Max invocation arguments on a single line

Property names:

[resharper_]csharp_max_invocation_arguments_on_line, [resharper_]max_invocation_arguments_on_line

Possible values:

an integer

Examples:

value: 0

{ CallMethod(arg1); CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3); CallMethod(arg1, arg2, arg3, arg4); CallMethod(arg1, arg2, arg3, arg4, arg5); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); }

value: 1

{ CallMethod(arg1); CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3); CallMethod(arg1, arg2, arg3, arg4); CallMethod(arg1, arg2, arg3, arg4, arg5); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); }

value: 2

{ CallMethod(arg1); CallMethod(arg1, arg2); CallMethod(arg1, arg2, arg3); CallMethod(arg1, arg2, arg3, arg4); CallMethod(arg1, arg2, arg3, arg4, arg5); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); }

Keep existing arrangement of parenthesis in invocation

Property names:

[resharper_]csharp_keep_existing_invocation_parens_arrangement, [resharper_]csharp_keep_existing_arrangement, [resharper_]keep_existing_invocation_parens_arrangement, [resharper_]keep_existing_arrangement

Possible values:

true | false

Examples:

Before formatting

After formatting, true

CallMethod ( arg1, arg2, arg3, arg4, arg5 );
CallMethod ( arg1, arg2, arg3, arg4, arg5 );

Before formatting

After formatting, false

CallMethod ( arg1, arg2, arg3, arg4, arg5 );
CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer to wrap before '(' in invocation

Property names:

[resharper_]csharp_wrap_before_invocation_lpar, [resharper_]wrap_before_invocation_lpar

Possible values:

true | false

Examples:

true

CallMethod (arg1, arg2, arg3, arg4, arg5);

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer to wrap after '(' in invocation

Property names:

[resharper_]csharp_wrap_after_invocation_lpar, [resharper_]wrap_after_invocation_lpar

Possible values:

true | false

Examples:

true

CallMethod( arg1, arg2, arg3, arg4, arg5);

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer to wrap before ')' in invocation

Property names:

[resharper_]csharp_wrap_before_invocation_rpar, [resharper_]wrap_before_invocation_rpar

Possible values:

true | false

Examples:

true

CallMethod(arg1, arg2, arg3, arg4, arg5 );

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Arrangement of member access expressions

Prefer to wrap after '.'

Property names:

[resharper_]csharp_wrap_after_dot_in_method_calls, [resharper_]wrap_after_dot_in_method_calls

Possible values:

true | false

Examples:

true

obj.Method(). Method(). Method(). Method(). Method(). Method(). Method(). Method(). Method(). Method();

false

obj.Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method();

Wrap chained method calls

Property names:

[resharper_]csharp_wrap_chained_method_calls, [resharper_]wrap_chained_method_calls

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

obj.Method().Method() + obj.Method().Method() .Method().Method() .Method().Method() .Method().Method() .Method().Method();

chop_if_long

obj.Method().Method() + obj.Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method();

chop_always

obj.Method() .Method() + obj.Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method();

Prefer to wrap before first method call

Property names:

[resharper_]csharp_wrap_before_first_method_call, [resharper_]wrap_before_first_method_call

Possible values:

true | false

Examples:

true

obj .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method();

false

obj.Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method() .Method();

Prefer to wrap after properties and fields in chained method calls

Property names:

[resharper_]csharp_wrap_after_property_in_chained_method_calls, [resharper_]wrap_after_property_in_chained_method_calls

Possible values:

true | false

Examples:

true

obj.Property .Method() .Property .Method() .Property .Method() .Property .Method() .Property .Method();

false

obj.Property.Method() .Property.Method() .Property.Method() .Property.Method() .Property.Method();

Arrangement of binary expressions

Prefer to wrap before operator in binary expression

Property names:

[resharper_]csharp_wrap_before_binary_opsign, [resharper_]wrap_before_binary_opsign

Possible values:

true | false

Examples:

true

myField1 = expression1 + expression2 + expression3 + expression4 + expression5 + expression6 + expression7;

false

myField1 = expression1 + expression2 + expression3 + expression4 + expression5 + expression6 + expression7;

Wrap chained binary expressions

Property names:

[resharper_]csharp_wrap_chained_binary_expressions, [resharper_]wrap_chained_binary_expressions

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

Examples:

wrap_if_long

b = a != b && c != d && e && f.IsSumOf(g, h) && i.Value == j && k == l && m == n && o == p;

chop_if_long

b = a != b && c != d && e && f.IsSumOf(g, h) && i.Value == j && k == l && m == n && o == p;

Prefer to wrap before operator in binary pattern

Property names:

[resharper_]csharp_wrap_before_binary_pattern_op, [resharper_]wrap_before_binary_pattern_op

Possible values:

true | false

Examples:

true

b = foo is VeryLongName1 or VeryLongName2 or VeryLongName3 or VeryLongName4 or VeryLongName5;

false

b = foo is VeryLongName1 or VeryLongName2 or VeryLongName3 or VeryLongName4 or VeryLongName5;

Wrap complex binary patterns

Property names:

[resharper_]csharp_wrap_chained_binary_patterns, [resharper_]wrap_chained_binary_patterns

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

Examples:

wrap_if_long

b = foo is C1 or C2 or C3 or C4 or C5 or VeryLongName1 or VeryLongName2 or VeryLongName3;

chop_if_long

b = foo is C1 or C2 or C3 or C4 or C5 or VeryLongName1 or VeryLongName2 or VeryLongName3;

Force chop compound condition in 'if' statement

Property names:

[resharper_]csharp_force_chop_compound_if_expression, [resharper_]force_chop_compound_if_expression

Possible values:

true | false

Examples:

true

if (var1 == null || var2 == null) Foo();

false

if (var1 == null || var2 == null) Foo();

Force chop compound condition in 'while' statement

Property names:

[resharper_]csharp_force_chop_compound_while_expression, [resharper_]force_chop_compound_while_expression

Possible values:

true | false

Examples:

true

while (var1 == null || var2 == null) Foo();

false

while (var1 == null || var2 == null) Foo();

Force chop compound condition in 'do' statement

Property names:

[resharper_]csharp_force_chop_compound_do_expression, [resharper_]force_chop_compound_do_expression

Possible values:

true | false

Examples:

true

do { Foo(); } while (var1 == null || var2 == null);

false

do { Foo(); } while (var1 == null || var2 == null);

Arrangement of ternary expressions

Prefer to wrap before '?' and ':' in ternary expressions

Property names:

[resharper_]csharp_wrap_before_ternary_opsigns, [resharper_]wrap_before_ternary_opsigns

Possible values:

true | false

Examples:

true

return hereGoesSomeBoolExpression ? returnThisIfTrue : returnThatIfFalse;

false

return hereGoesSomeBoolExpression ? returnThisIfTrue : returnThatIfFalse;

Wrap ternary expression

Property names:

[resharper_]csharp_wrap_ternary_expr_style, [resharper_]wrap_ternary_expr_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

myField = someCondition ? true : false;

chop_if_long

myField = someCondition ? true : false;

chop_always

myField = someCondition ? true : false;

Nested ternary expression style

Property names:

[resharper_]csharp_nested_ternary_style, [resharper_]nested_ternary_style

Possible values:

  • simple_wrap: Simple wrap/Do not change

  • autodetect: Chop in existing style

  • compact: Chop in compact style

  • expanded: Chop in expanded style

Examples:

Before formatting

After formatting, simple_wrap

{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }
{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }

Before formatting

After formatting, autodetect

{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }
{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }

Before formatting

After formatting, compact

{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }
{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }

Before formatting

After formatting, expanded

{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }
{ a = i ? "am" : you ? "are" : "is"; b = error ? red : warning ? yellow : green; c = tiger ? dangerous : cat ? cute : boring; d = roses ? red : violets ? blue : so_are_you; }

Arrangement of LINQ expressions

Wrap LINQ expressions

Property names:

[resharper_]csharp_wrap_linq_expressions, [resharper_]wrap_linq_expressions

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

var result = from x in list where cond(x) select x;

chop_if_long

var result = from x in list where cond(x) select x;

chop_always

var result = from x in list where cond(x) select x;

Prefer to wrap before multiline LINQ expressions

Property names:

[resharper_]csharp_wrap_before_linq_expression, [resharper_]wrap_before_linq_expression

Possible values:

true | false

Examples:

true

var result = from x in list where cond(x) select x;

false

var result = from x in list where cond(x) select x;

Place 'into' on a new line in LINQ expressions

Property names:

[resharper_]csharp_place_linq_into_on_new_line, [resharper_]place_linq_into_on_new_line

Possible values:

true | false

Examples:

true

var q1 = from i in l select i into j where j != 0 select j;

false

var q1 = from i in l select i into j where j != 0 select j;

Arrangement of interpolated strings

Wrap interpolated strings

Property names:

[resharper_]csharp_wrap_verbatim_interpolated_strings, [resharper_]wrap_verbatim_interpolated_strings

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • no_wrap: Do not wrap even if long

Examples:

wrap_if_long

var s1 = $"id={id} src={src } dest={dest}"; var s2 = $@"id={id} src={src } dest={dest}"; var s3 = $""" id={id} src={src } dest={dest} """;

chop_if_long

var s1 = $"id={ id } src={ src } dest={ dest }"; var s2 = $@"id={ id } src={ src } dest={ dest }"; var s3 = $""" id={ id } src={ src } dest={ dest } """;

no_wrap

var s1 = $"id={id} src={src} dest={dest}"; var s2 = $@"id={id} src={src} dest={dest}"; var s3 = $""" id={id} src={src} dest={dest} """;
Last modified: 26 May 2024