现在 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/