Visual Studio中的Curly Bracket默认布局

why*_*heq 3 c# visual-studio-2010

在创建条件语句或方法时,IDE跳转到:

      if (true)
      {
       //code here      
      }
Run Code Online (Sandbox Code Playgroud)

但我更喜欢以下更紧凑的风格(并经常用于教科书)

      if (true) {
       //code here      
      }
Run Code Online (Sandbox Code Playgroud)

visual studio中是否有设置来更改默认样式?

Raw*_*ing 7

转到Tools> Options在顶部的菜单栏.

在左边的面板中,转到Text Editor> C#> Formatting> New Lines.

if块的选项是Place open brace on new line for control blocks,但您可能也想为其他类型的块更改它.您可能还想要改变Place "else" on new line.

  • 这是非常好的 - 这个IDE是相当一部分工作 - MS真的投入了很多...... (2认同)