`
RednaxelaFX
  • 浏览: 3016501 次
  • 性别: Icon_minigender_1
  • 来自: 海外
社区版块
存档分类
最新评论

[Phalanx] Visual Studio 2008的一些源码格式化配置

阅读更多
Visual Studio 2008里,在菜单的Tools->Options...->C#,
General里,把Line numbers打上钩;

Formatting里,

Indentation:
Indent block contents
Indent case contents
这两个打勾,其它不打勾;
Label Indentation选第二个:Place goto labels one indent less than current;

New Lines:
New line options for braces:
Place open brace on new line for types
New line options for expressions:
Place members in object initializers on new line
Place members in anonymous types on new line
Place query expression clauses on new line
以上打勾,其它不打勾;

Spacing:
Set spaceing for method declarations:
Insert space within argument list parentheses
Insert space within empty argument list parentheses
Set spacing for method calls:
Insert space within argument list parentheses
Insert space within empty argument list parentheses
Set other spacing options:
Insert space after keywords in control flow statements
Insert space within parentheses of expressions
Insert space within parentheses of type casts
Insert spaces inside parentheses for control flow statements
Insert space after cast
Set spacing for brackets:
Insert space within empty square brackets
Insert spaces within square brackets
Set spacing for delimiters:
Insert space after colon for base or interface in type declaration
Insert space after comma
Insert space after semicolon in "for" statement
Insert space before colon for base or interface in type declaration
以上打勾,其它不打勾;
Set spacing for operators,选第一个:Insert space before and after binary operators。

在完成以上配置后,按Ok来保存设置。
以后,在C#的代码编辑界面里,按Ctrl+E,D(按着Ctrl的同时依次按下E和D)或者在菜单的Edit->Advanced->Format Document就可以对C#源代码做自动的格式化。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics