本文介绍了在if语句旁边重新整理移动大括号。如何换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Resharper 8正在自动格式化在大括号中。大括号移到IF语句行的末尾。如何将其格式化为下一行。

My Resharper 8 is auto formatting on the end brace. The top brace moves to the end of the IF statement line. How can I have it format to the next line.

起始语句

if (condition)
{
    var x = new foo();
}

移除底部花括号并重新键入后,便会得到结果。大括号移动到上面的行的结尾。

When the bottom brace is removed and retyped this is the result. The top brace moves to the end of the line above.

if (condition) {
    var x = new foo();
}

所需的结果是初始开始语句。

如何更改R#8中的选项以解决此问题?我尝试更改 C#/格式/大括号布局选项中的选项。

How can I change the options in R#8 to fix this? I have tried changing options in the C# / Formatting / Braces layout options.

推荐答案

我找到了。在格式设置样式->换行和换行->保留现有格式下,将使用单个语句在块中中断行更改为中断行。

I found it. Under Formatting Style --> Line Breaks and Wrapping --> Preserve Existing Formatting, change "Break line in a block with a single statement" to "break line".

这篇关于在if语句旁边重新整理移动大括号。如何换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:24