c# - Visual Studio 中的大括号默认布局

标签 c# visual-studio-2010

创建条件语句或方法时,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/

相关文章:

c# - MEF 是一件全有还是全无的事情吗?

c# - 找不到为 MVC 5 DropDownListFor 添加占位符的方法

c# - 使用工作表作为数据源的 VSTO Excel 简单示例

c++ - Dialog MFC 资源测量的单位是什么

c# - 您可以将 SignalR 与 Visual Studio 2012 一起使用吗?

c# - 尝试创建 NHibernate 和 FluentNHibernate 来连接 MySQL?

C# 重载方法错误

c++ - 如何配置 Qt 以使用 Visual Studio 2010?

visual-studio-2010 - 对象浏览器无法浏览我自己的解决方案?

c - ATI 流 OpenCL : Problem while opening opencl kernel file in Visual Studio 2010