创建条件语句或方法时,IDE 会跳转到:
if (true)
{
//code here
}
但我更喜欢以下更紧凑的样式(并且经常在教科书中使用)
if (true) {
//code here
}
visual studio 中是否有更改默认样式的设置?
最佳答案
转到顶部菜单栏中的工具
> 选项
。
在左侧面板中,转到 Text Editor
> C#
> Code Style
> Formatting
> 新行
。
if
block 的选项是Place open brace on new line for control blocks
,但您可能也想为其他类型的 block 更改它。您可能还想更改 Place "else"on new line
。
关于c# - Visual Studio 中的大括号默认布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12276749/