是否有ReSharper的一个选项,不把对象初始值设定多条线路? [英] Is there an option in ReSharper to not put an object initializer on multiple lines?

查看:100
本文介绍了是否有ReSharper的一个选项,不把对象初始值设定多条线路?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每次键入对象初始化作为一个参数,像这样的:

Every time I type an object initializer as a parameter, like this:

SomeFunc(new { Id = id })

和之后键入分号,ReSharper的格式是什么我刚才输入,按照配置。
但是,我找不到ReSharper的一个选项,以使其无法打开我的代码变成这样:

and type the semicolon afterwards, ReSharper formats what I just typed, as configured. However, I cannot find an option in ReSharper to make it not turn my code into this:

SomeFunc(new {
  Id = id
});



我没有证实它实际上是ReSharper的做的格式。

I did confirm it actually is ReSharper doing the formatting.

推荐答案

如果你想保持ReSharper的,从格式化你的对象初始化(这样你就可以决定如何对他们自己格式化),我想这些设置的组合将做。工作

If you want to keep ReSharper from formatting your object initializers (so you can decide how you want to format them yourself), I think a combination of these settings will do the job.

保留现有的换行 [选中]

放在一行简单数组,对象和集合: [选中]

Place simple array, object and collection on single line : [Checked]

裹对象和集合初始化简单包装

回绕长行 [未选中]

当然,这些设置可能不适合每个人的情况,但我敢肯定,你可以使其适应您的需求。

Of course, these settings might not fit everyone's situation, but I'm sure you can adapt them to your needs.

这篇关于是否有ReSharper的一个选项,不把对象初始值设定多条线路?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆