JetBrains Rider 2026.3 Help

EditorConfig 属性用于 C#: 制表符、缩进、对齐

此页面列出了自定义 JetBrains Rider EditorConfig 属性 ,您可以使用这些属性来配置 C# 中的格式化首选项,特别是如何缩进和对齐不同的代码结构。

通用

缩进样式

属性名称:

indent_style, [resharper_]csharp_缩进_样式

可能的值:

  • 制表符 :制表符

  • 空格 :空格

示例:

制表符

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

空格

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

缩进大小

属性名称:

indent_size, [resharper_]csharp_缩进_大小

可能的值:

整数

示例:

值:0

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

值:1

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

值:2

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

制表符宽度

属性名称:

tab_width, [resharper_]csharp_Tab_宽度

可能的值:

整数

示例:

值:0

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

值:1

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

值:2

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

连续行缩进乘数

属性名称:

[resharper_]csharp_连续_缩进_乘数, [resharper_]连续_缩进_乘数

可能的值:

整数

示例:

值:0

int x = foo1() + foo2();

值:1

int x = foo1() + foo2();

值:2

int x = foo1() + foo2();

嵌套语句

缩进嵌套的 'using' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_using_语句, [resharper_]缩进_嵌套_using_语句

可能的值:

true | false

示例:

真

using (A a = new A()) using (B b = new B()) using (C c = new C()) { foo(); }

false

using (A a = new A()) using (B b = new B()) using (C c = new C()) { foo(); }

缩进嵌套的 'fixed' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_fixed_语句, [resharper_]缩进_嵌套_fixed_语句

可能的值:

true | false

示例:

真

fixed (int* a = &x) fixed (int* b = &y) fixed (int* c = &z) { foo(); }

false

fixed (int* a = &x) fixed (int* b = &y) fixed (int* c = &z) { foo(); }

缩进嵌套的 'lock' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_lock_语句, [resharper_]缩进_嵌套_lock_语句

可能的值:

true | false

示例:

真

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

false

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

缩进嵌套的 'for' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_for_语句, [resharper_]缩进_嵌套_for_语句

可能的值:

true | false

示例:

真

for (int a = 0; a < x; a++) for (int b = 0; b < y; b++) for (int c = 0; c < y; c++) { foo(); }

false

for (int a = 0; a < x; a++) for (int b = 0; b < y; b++) for (int c = 0; c < y; c++) { foo(); }

缩进嵌套的 'foreach' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_foreach_语句, [resharper_]缩进_嵌套_foreach_语句

可能的值:

true | false

示例:

真

foreach (var a in x) foreach (var b in y) foreach (var c in z) { foo(); }

false

foreach (var a in x) foreach (var b in y) foreach (var c in z) { foo(); }

缩进嵌套的 'while' 语句

属性名称:

[resharper_]csharp_缩进_嵌套_while_语句, [resharper_]缩进_嵌套_while_语句

可能的值:

true | false

示例:

真

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

false

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

括号

在圆括号内使用连续行缩进

属性名称:

[resharper_]csharp_在_括号_内_使用_连续_缩进, [resharper_]在_括号_内_使用_连续_缩进

可能的值:

true | false

示例:

真

var x = Method( parameter1, parameter2 );

false

var x = Method( parameter1, parameter2 );

缩进方法声明的圆括号

属性名称:

[resharper_]csharp_缩进_方法_声明_括号, [resharper_]缩进_方法_声明_括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

void Method( int parameter1, int parameter2 );

外部

void Method( int parameter1, int parameter2 );

外部和内部

void Method( int parameter1, int parameter2 );

无

void Method( int parameter1, int parameter2 );

缩进主构造函数声明的圆括号

属性名称:

[resharper_]csharp_缩进_主_构造函数_声明_括号, [resharper_]缩进_主_构造函数_声明_括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

record Person( string Name, int Age );

外部

record Person( string Name, int Age );

外部和内部

record Person( string Name, int Age );

无

record Person( string Name, int Age );

缩进方法调用的圆括号

属性名称:

[resharper_]csharp_缩进_调用_括号, [resharper_]缩进_调用_括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

var x = Method( parameter1, parameter2 );

外部

var x = Method( parameter1, parameter2 );

外部和内部

var x = Method( parameter1, parameter2 );

无

var x = Method( parameter1, parameter2 );

缩进语句(if、while、for 等)圆括号

属性名称:

[resharper_]csharp_缩进_语句_括号, [resharper_]缩进_语句_括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

if ( condition1 && condition2 ) return;

外部

if ( condition1 && condition2 ) return;

外部和内部

if ( condition1 && condition2 ) return;

无

if ( condition1 && condition2 ) return;

缩进类型形参的尖括号

属性名称:

[resharper_]csharp_缩进_类型参数_尖括号, [resharper_]缩进_类型参数_尖括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

void Method< T1, T2 >();

外部

void Method< T1, T2 >();

外部和内部

void Method< T1, T2 >();

无

void Method< T1, T2 >();

缩进类型实参的尖括号

属性名称:

[resharper_]csharp_缩进_类型实参_尖括号, [resharper_]缩进_类型实参_尖括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

var x = Method< Class1, Class2 >();

外部

var x = Method< Class1, Class2 >();

外部和内部

var x = Method< Class1, Class2 >();

无

var x = Method< Class1, Class2 >();

缩进其他圆括号和中括号

属性名称:

[resharper_]csharp_缩进_括号, [resharper_]缩进_括号

可能的值:

  • 内部 :括号内(BSD/K&R 风格)

  • 外部 :括号和内部对齐(Whitesmiths 风格)

  • 外部和内部 :括号 1 次,内部 2 次(GNU 风格)

  • 无 :无缩进

示例:

内部

var x = 1 * checked( 5 + 6 );

外部

var x = 1 * checked( 5 + 6 );

外部和内部

var x = 1 * checked( 5 + 6 );

无

var x = 1 * checked( 5 + 6 );

预处理器指令

缩进 #if、#else、#elif、#endif

属性名称:

[resharper_]csharp_缩进_预处理器_if, [resharper_]缩进_预处理器_if

可能的值:

  • 无缩进 :无缩进

  • 按常规缩进: 按常规缩进

  • 减少缩进: 减少缩进

  • 不要更改 :不要更改

示例:

无缩进

namespace N { class C { #if !HideSomething int myField; #endif } }

按常规缩进

namespace N { class C { #if !HideSomething int myField; #endif } }

减少缩进

namespace N { class C { #if !HideSomething int myField; #endif } }

不要更改

namespace N { class C { #if !HideSomething int myField; #endif } }

缩进 #region、#endregion

属性名称:

[resharper_]csharp_缩进_预处理器_region, [resharper_]缩进_预处理器_region

可能的值:

  • 无缩进 :无缩进

  • 按常规缩进: 按常规缩进

  • 减少缩进: 减少缩进

  • 不要更改 :不要更改

示例:

无缩进

namespace N { class C { #region Fields int myField; #endregion } }

按常规缩进

namespace N { class C { #region Fields int myField; #endregion } }

减少缩进

namespace N { class C { #region Fields int myField; #endregion } }

不要更改

namespace N { class C { #region Fields int myField; #endregion } }

缩进其他预处理程序指令

属性名称:

[resharper_]csharp_缩进_预处理器_其他, [resharper_]缩进_预处理器_其他

可能的值:

  • 无缩进 :无缩进

  • 按常规缩进: 按常规缩进

  • 减少缩进: 减少缩进

  • 不要更改 :不要更改

示例:

无缩进

namespace N { class C { #pragma warning disable CS3021 int myField; #warning Fixme } }

按常规缩进

namespace N { class C { #pragma warning disable CS3021 int myField; #warning Fixme } }

减少缩进

namespace N { class C { #pragma warning disable CS3021 int myField; #warning Fixme } }

不要更改

namespace N { class C { #pragma warning disable CS3021 int myField; #warning Fixme } }

其他缩进

缩进 'switch' 中的 'case'

属性名称:

csharp_缩进_switch_标签, [resharper_]缩进_switch_标签

可能的值:

true | false

示例:

真

switch (expression) { case 0: break; }

false

switch (expression) { case 0: break; }

减少缩进语句标签

属性名称:

[resharper_]csharp_减少缩进_语句_标签, [resharper_]减少缩进_语句_标签

可能的值:

true | false

示例:

真

{ int a = 5; MyLabel: a--; if (a > 0) goto MyLabel; }

false

{ int a = 5; MyLabel: a--; if (a > 0) goto MyLabel; }

缩进类型约束

属性名称:

[resharper_]csharp_缩进_类型_约束, [resharper_]缩进_类型_约束

可能的值:

true | false

示例:

真

class C1<T1> where T1 : I1 { }

false

class C1<T1> where T1 : I1 { }

不缩进从第一列开始的注释

属性名称:

[resharper_]csharp_紧贴_注释, [resharper_]紧贴_注释

可能的值:

true | false

示例:

格式化之前

格式化之后,真

namespace N { // Some comment class C { } }
namespace N { // Some comment class C { } }

格式化之前

格式化之后,假

namespace N { // Some comment class C { } }
namespace N { // Some comment class C { } }

注释掉代码时将注释置于第一列

属性名称:

[resharper_]csharp_将_注释_放在_第一列, [resharper_]将_注释_放在_第一列

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

可能的值:

true | false

在部分格式上使用上一个元素的缩进

属性名称:

[resharper_]csharp_使用_上一个_元素_的_缩进, [resharper_]使用_上一个_元素_的_缩进

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.

可能的值:

true | false

缩进语句条件内的大括号

属性名称:

[resharper_]csharp_缩进_语句_条件_内部_花括号, [resharper_]缩进_语句_条件_内部_花括号

可能的值:

true | false

示例:

真

while (x is IMyInterface { Prop1: 1, Prop2: 2 }) { DoSomething(); }

false

while (x is IMyInterface { Prop1: 1, Prop2: 2 }) { DoSomething(); }

对齐多行结构

制表符用于缩进时如何对齐

属性名称:

[resharper_]csharp_对齐_Tab_填充_样式, [resharper_]alignment_tab_fill_style

可能的值:

  • 使用空格 :使用空格(在任何制表符大小下看起来都对齐)

  • 仅使用制表符: 仅使用制表符(不准确)

  • 最佳填充: 混合使用制表符和空格以实现最佳填充

示例:

使用空格

SomeMyMethod(param1, param2);

仅使用制表符

SomeMyMethod(param1, param2);

最佳填充

SomeMyMethod(param1, param2);

即使结果缩进过大也要对齐

属性名称:

[resharper_]csharp_允许_远距离_对齐, [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

可能的值:

true | false

方法参数

属性名称:

[resharper_]csharp_对齐_多行_参数, [resharper_]对齐_多行_参数

可能的值:

true | false

示例:

真

void fooCall(int firstParameter, int secondParameter) { }

false

void fooCall(int firstParameter, int secondParameter) { }

基类和接口列表

属性名称:

[resharper_]csharp_对齐_多行_extends_列表, [resharper_]对齐_多行_extends_列表

可能的值:

true | false

示例:

真

class C : BaseClass, SomeInterface { }

false

class C : BaseClass, SomeInterface { }

LINQ 查询

属性名称:

[resharper_]csharp_对齐_LINQ_查询, [resharper_]对齐_LINQ_查询

可能的值:

true | false

示例:

真

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

false

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

二項式

属性名称:

[resharper_]csharp_对齐_多行_二进制_表达式_链, [resharper_]对齐_多行_二进制_表达式_链

可能的值:

true | false

示例:

真

var a = someOperand + operand2 + operand3 + operand4;

false

var a = someOperand + operand2 + operand3 + operand4;

减少缩进二元运算符

属性名称:

[resharper_]csharp_减少缩进_二进制_运算符, [resharper_]减少缩进_二进制_运算符

可能的值:

true | false

示例:

真

{ var a = someOperand + operand2 + operand3 + operand4; var b = someOperand + operand2 + operand3 + operand4; }

false

{ var a = someOperand + operand2 + operand3 + operand4; var b = someOperand + operand2 + operand3 + operand4; }

链式方法调用

属性名称:

[resharper_]csharp_对齐_多行_调用_链, [resharper_]对齐_多行_调用_链

可能的值:

true | false

示例:

真

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

false

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

减少缩进链式方法调用中的点

属性名称:

[resharper_]csharp_减少缩进_点, [resharper_]减少缩进_点

可能的值:

true | false

示例:

真

{ var a = MyVar .SomeMethod() ?.OtherMethod() .ThirdMethod(); var b = MyVar .SomeMethod() ?.OtherMethod() .ThirdMethod(); }

false

{ var a = MyVar .SomeMethod() ?.OtherMethod() .ThirdMethod(); var b = MyVar .SomeMethod() ?.OtherMethod() .ThirdMethod(); }

数组、对象和集合初始值设定项

属性名称:

[resharper_]csharp_对齐_多行_数组_和_对象_初始值设定项, [resharper_]对齐_多行_数组_和_对象_初始值设定项

可能的值:

true | false

示例:

真

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

false

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

Switch 表达式

属性名称:

[resharper_]csharp_对齐_多行_switch_表达式, [resharper_]对齐_多行_switch_表达式

可能的值:

true | false

示例:

真

var z = op switch { op.Add => x + y, op.Subtract => x - y, op.Multiply => x * y, op.Divide => x / y }

false

var z = op switch { op.Add => x + y, op.Subtract => x - y, op.Multiply => x * y, op.Divide => x / y }

属性模式

属性名称:

[resharper_]csharp_对齐_多行_属性_模式, [resharper_]对齐_多行_属性_模式

可能的值:

true | false

示例:

真

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

false

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

列表模式和集合表达式

属性名称:

[resharper_]csharp_对齐_多行_列表_模式, [resharper_]对齐_多行_列表_模式

可能的值:

true | false

示例:

真

int[] collection = [ 1, 2, 3 ]; var matches = collection is [ 1, > 0, not 42 ];

false

int[] collection = [ 1, 2, 3 ]; var matches = collection is [ 1, > 0, not 42 ];

二元模式

属性名称:

[resharper_]csharp_对齐_多行_二进制_模式, [resharper_]对齐_多行_二进制_模式

可能的值:

true | false

示例:

真

var a = e is someOperand or operand2 or operand3 or operand4;

false

var a = e is someOperand or operand2 or operand3 or operand4;

减少缩进二元模式

属性名称:

[resharper_]csharp_减少缩进_二进制_模式_运算符, [resharper_]减少缩进_二进制_模式_运算符

可能的值:

true | false

示例:

真

{ var a = e is someOperand or operand2 or operand3 or operand4; var b = e is someOperand or operand2 or operand3 or operand4; }

false

{ var a = e is someOperand or operand2 or operand3 or operand4; var b = e is someOperand or operand2 or operand3 or operand4; }

匿名方法体

属性名称:

[resharper_]csharp_缩进_匿名_方法_块, [resharper_]缩进_匿名_方法_块

可能的值:

true | false

示例:

真

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

false

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

将调用实参对齐到 '('

属性名称:

[resharper_]csharp_按_括号_对齐_第一个_实参, [resharper_]按_括号_对齐_第一个_实参

可能的值:

true | false

示例:

真

fooCall( firstParameter, secondParameter);

false

fooCall( firstParameter, secondParameter);

调用参数

属性名称:

[resharper_]csharp_对齐_多行_实参, [resharper_]对齐_多行_实参

可能的值:

true | false

示例:

真

fooCall(firstParameter, secondParameter);

false

fooCall(firstParameter, secondParameter);

元组组件

属性名称:

[resharper_]csharp_对齐_元组_组件, [resharper_]对齐_元组_组件

可能的值:

true | false

示例:

真

var tuple = (firstParameter, secondParameter);

false

var tuple = (firstParameter, secondParameter);

其他表达式

属性名称:

[resharper_]csharp_对齐_多行_表达式, [resharper_]对齐_多行_表达式

可能的值:

true | false

示例:

真

destination = source1 ? source2 : source3

false

destination = source1 ? source2 : source3

圆括号内的语句条件

属性名称:

[resharper_]csharp_对齐_多行_语句_条件, [resharper_]对齐_多行_语句_条件

可能的值:

true | false

示例:

真

while (x is IMyInterface or IMyInterface2 or IMyInterface3 { Prop1: 1, Prop2: 2 }) { DoSomething(); }

false

while (x is IMyInterface or IMyInterface2 or IMyInterface3 { Prop1: 1, Prop2: 2 }) { DoSomething(); }

'for' 语句头

属性名称:

[resharper_]csharp_对齐_多行_for_语句, [resharper_]对齐_多行_for_语句

可能的值:

true | false

示例:

真

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

false

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

多个声明

属性名称:

[resharper_]csharp_对齐_多个_声明, [resharper_]对齐_多个_声明

可能的值:

true | false

示例:

真

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

false

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

类型参数列表

属性名称:

[resharper_]csharp_对齐_多行_类型_参数_列表, [resharper_]对齐_多行_类型_参数_列表

可能的值:

true | false

示例:

真

class Class<T1, T2, T3> { }

false

class Class<T1, T2, T3> { }

类型形参约束

属性名称:

[resharper_]csharp_对齐_多行_类型_参数_约束, [resharper_]对齐_多行_类型_参数_约束

可能的值:

true | false

示例:

真

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

false

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

减少缩进逗号

属性名称:

[resharper_]csharp_减少缩进_逗号, [resharper_]减少缩进_逗号

可能的值:

true | false

示例:

真

class Class< T1 , T3> : Base , SomeInterface { void fooCall( int firstParameter , int secondParameter) { fooCall( firstParameter , secondParameter); } }

false

class Class< T1 , T3> : Base , SomeInterface { void fooCall( int firstParameter , int secondParameter) { fooCall( firstParameter , secondParameter); } }

将多行注释与星号对齐

属性名称:

[resharper_]csharp_对齐_多行_注释, [resharper_]对齐_多行_注释

可能的值:

true | false

示例:

真

DoSomething(); /* This is * badly aligned * comment */

false

DoSomething(); /* This is * badly aligned * comment */

如何缩进原始字符串字面量

属性名称:

[resharper_]csharp_缩进_原始_文字_字符串, [resharper_]缩进_原始_文字_字符串

可能的值:

  • 对齐 :对齐

  • 缩进: 缩进到上一行

  • 不要更改 :不要更改

示例:

对齐

string x = """ Some literal text with indents or without """;

缩进

string x = """ Some literal text with indents or without """;

不要更改

string x = """ Some literal text with indents or without """;

对齐相似代码为列

修正相邻行中的列对齐

属性名称:

[resharper_]csharp_int_对齐_修复_相邻项中, [resharper_]int_对齐_修复_相邻项中

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

可能的值:

true | false

字段和常量

属性名称:

[resharper_]csharp_int_对齐_字段、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_字段、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

class C { [Attr] private string x = "x"; [Attr(2)] public SomeClass xxxxx = "xxxxx"; [Attr, Attr3] private string xxx; }

false

class C { [Attr] private string x = "x"; [Attr(2)] public SomeClass xxxxx = "xxxxx"; [Attr, Attr3] private string xxx; }

属性和事件

属性名称:

[resharper_]csharp_int_对齐_属性、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_属性、 [resharper_]int_对齐

可能的值:

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

false

class C { [Attr] private string x { get; set; } = "x"; [Attr(2)] public SomeClass xxxxx { get; set; } = SomeClass.Default; [Attr, Attr3] private string xxx { get; } [Attr] private string x2 => "x"; [Attr(2)] public SomeClass xxxxx2 => "xxxxx"; [Attr, Attr3] private string xxx2 => "xxx"; }

简单方法、运算符、委托

属性名称:

[resharper_]csharp_int_对齐_方法、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_方法、 [resharper_]int_对齐

可能的值:

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

false

class C { [Attr] private string x(int p) { return "x" + p; }; [Attr(2)] public SomeClass xxxxx(string b) { return b.ToSomeClass(); } [Attr, Attr3] private string xxx() { return null; } [Attr] private string x2(int p) => "x" + p; [Attr(2)] public SomeClass xxxxx2(string b) => b.ToSomeClass(); [Attr, Attr3] private string xxx() => null; }

多行方法签名

属性名称:

[resharper_]csharp_int_对齐_参数、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_参数、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

void MyMethod( [Attr, Attr3] string xxx, [Attr] string x = "x", [Attr(2)] SomeClass xxxxx = "xxxxx") { }

false

void MyMethod( [Attr, Attr3] string xxx, [Attr] string x = "x", [Attr(2)] SomeClass xxxxx = "xxxxx") { }

变量和局部常量

属性名称:

[resharper_]csharp_int_对齐_变量、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_变量、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

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

false

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

其他赋值和初始值设定项

属性名称:

[resharper_]csharp_int_对齐_赋值、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_赋值、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

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

false

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

属性模式

属性名称:

[resharper_]csharp_int_对齐_属性_模式、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_属性_模式、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

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

false

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

嵌套三元运算符

属性名称:

[resharper_]csharp_int_对齐_嵌套_三元、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_嵌套_三元、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

var x = y == "a" ? 1 : y == "aaaa" ? 4 : y == "aa" ? 2 : 0;

false

var x = y == "a" ? 1 : y == "aaaa" ? 4 : y == "aa" ? 2 : 0;

相同方法的调用

属性名称:

[resharper_]csharp_int_对齐_调用、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_调用、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

[Attr("x", 1234567)] [Attr("xxxxx", 1)] [Attr(MyEnum.MyConstant, 124)] void MyMethod() { CallMe("x", 1234567); CallMe("xxxxx", 1); CallMe(MyEnum.MyConstant, 124); }

false

[Attr("x", 1234567)] [Attr("xxxxx", 1)] [Attr(MyEnum.MyConstant, 124)] void MyMethod() { CallMe("x", 1234567); CallMe("xxxxx", 1); CallMe(MyEnum.MyConstant, 124); }

二項式

属性名称:

[resharper_]csharp_int_对齐_二进制_表达式、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_二进制_表达式、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

if ( zzz || someCondition && otherCondition || aa && bb || x == "a" || xxxxxxx != "aaaa" || xx > "aa") { DoSomething(); }

false

if ( zzz || someCondition && otherCondition || aa && bb || x == "a" || xxxxxxx != "aaaa" || xx > "aa") { DoSomething(); }

结束注释

属性名称:

[resharper_]csharp_int_对齐_注释、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_注释、 [resharper_]int_对齐

可能的值:

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

false

{ DoSomething(); // I'm var y = 6; // forced while (y > 0) y--; // to DoSomethingElse(); /* document */ var z = 10; /* my code */ while (z < 100) z++; /* profusely */ }

简单 switch 部分

属性名称:

[resharper_]csharp_int_对齐_switch_节、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_switch_节、 [resharper_]int_对齐

可能的值:

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

false

switch (op) { case op.Add: return x + y; case op.Subtract: return x - y; case op.Multiply: return x * y; case op.Divide: return x / y; }

Switch 表达式

属性名称:

[resharper_]csharp_int_对齐_switch_表达式、 [resharper_]csharp_int_对齐、 [resharper_]int_对齐_switch_表达式、 [resharper_]int_对齐

可能的值:

true | false

示例:

真

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 }
2026年 11月 10日