c# - Visual Studio : Automatically insert a space after typing if(

标签 c# visual-studio visual-studio-2010 coding-style code-formatting

我们有一个代码风格检查器,它在每次 checkin 之前运行,要求 C# if 语句的格式如下:

if (condition)

但是,我的肌肉内存力已经可以打字了:

if(condition)

有什么方法可以让 Visual Studio 2010 在我键入没有空格的情况下自动插入该空格?我知道你可以设置它,当你粘贴代码时,它会自动执行此操作,但不会在键入时自动执行。谢谢!

最佳答案

工具 > 选项 > 文本编辑器 > C# > 格式化 > 间距

然后选中/勾选 Insert space after keywords in control flow statements,它列在 Set other spacing options 子组下。

赢了。

关于c# - Visual Studio : Automatically insert a space after typing if(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5398051/

相关文章:

c++ - 项目解决方案结构

c# - 如何在 Visual Studio 中开发独特的 GUI?

C#:你能检测出当前执行上下文是否在 `lock (this)` 内吗?

C# + IE9 JS引擎脉轮?

c# - 从配对列表中删除 'duplicates'

visual-studio - 加载 Microsoft Visual 菜单时出现问题

visual-studio - 错误3错误LNK1104 : cannot open file 'gtk-3.lib'

visual-studio-2010 - 设计时模式下的 NetFx40_LegacySecurityPolicy

.net - 将 DotnetZip 与 Visual Studio C++/CLR 结合使用

c# - 在 richtextbox 中突出显示 '#' 直到行结束