首页 新闻 会员 周边

visual studio 的 .edtorconfig 配置

0
悬赏园豆:10 [已解决问题] 解决于 2020-11-05 16:08

如何配置 .editorconfig,必须写 {}

if (n == null)
    throw new Exception("无效的数据");

规范为:

if (n == null)
{
    throw new Exception("无效的数据");
}
jzblive的主页 jzblive | 菜鸟二级 | 园豆:428
提问于:2020-11-05 14:01
< >
分享
最佳答案
0

这个规则英文叫 "enforce usage of brackets for if-loop",.editorconfig 中没有对应的配置,详见 Prefer braces in if-loop - .editorConfig

收获园豆:10
dudu | 高人七级 |园豆:31007 | 2020-11-05 14:43

感谢 dudu大佬的解答。
我使用了更加暴力的方式

# Expression-level preferences
csharp_prefer_braces                                = true:suggestion
jzblive | 园豆:428 (菜鸟二级) | 2020-11-05 16:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册