c# - 在 Resharper 中为对象和数组初始化程序获取正确的缩进

现在 resharper 像这样格式化我们的代码:

private readonly List<Folder> folders = new List<Folder>
                                        {
                                            new Folder()
                                        };

但我希望它看起来像这样:

private readonly List<Folder> folders = new List<Folder>
{
    new Folder()
};

我一直在弄乱这些选项,但似乎无法正确处理它们。你能帮忙吗?

最佳答案

我对匿名代表也有同样的问题。匿名委托(delegate)格式的修复是 here :

I did finally find the way to fix this. The options for formatting anonymous methods are spread across two separate pages in ReSharper options: Braces Layout and Other. The “don’t indent a ridiculous amount” is on the Other page, and it’s called “Indent anonymous method body”. Turn it off, and set the brace option to “At end of line”, and you get something much nicer:

但恐怕我不确定实例声明集合格式。 :(

https://stackoverflow.com/questions/519755/

相关文章:

c# - 如何将 bool 值一般格式化为是/否字符串?

java - 格式化带前导符号的数字

python - 使用 Python 减去两个 UNIX 时间戳时,如何产生人类可读的差异?

python - 将整数格式化为十六进制字符串

visual-studio-2010 - 在 ReSharper for Visual Studio

c - 在 C 中打印十六进制的前导零

java - 最好的 Eclipse 代码格式化程序?

c - 什么是 scanf ("%*s") 和 scanf ("%*d") 格式标识符?

json - 如何在传出的 JSON 中格式化时间戳

java - 如何在 Java 中计算时间跨度并格式化输出?