R# 中是否有设置将链接方法格式化为从实例化类的相同字符开始。
我想要的是:
var foo = new FooDataBuilder()
.WithDate(myDate)
.WithBar(myBar)
.Build();
R# 给了我什么:
var foo = new FooDataBuilder()
.WithDate(myDate)
.WithBar(myBar)
.Build();
使用 Resharper 7.1.2,您可以获得以下格式:
var foo = new FooDataBuilder().WithDate(myDate)
.WithBar(myBar)
.Build();
通过设置以下 Resharper 选项:
Code Editing
->C#
->Formatting Style
->Line Breaks and Wrapping
->Line Wrapping
->Wrap chained method calls
to Chop always
and
enable Code Editing
->C#
->Formatting Style
->Other
->Align Multiline Constructs
->Chained method calls
我认为你无法与FooDataBuilder()
除非你手动进行。(Jetbrains 的 @Dmitry Osinovskiy 已经证实了这一点,因此这可能是最接近您想要的结果。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)