是否有用于简化if语句中的布尔求值的EditorConfig设置?例如:
// prefer:
if (thingy)
// over:
if (thingy == true)和
// prefer:
if (!thingy)
// over:
if (thingy == false)发布于 2020-05-13 07:19:48
在您的解决方案路径中添加.editorconfig,如果您使用的是VSCode,请安装official C# plugin。要启用.editorconfig验证,只需进入设置(ctrl/command +,)>“扩展”>“Omnisharp配置”>选中"Omnisharp:启用编辑器配置支持“。此外,请确保选中了"Format: Enable“选项。
如果你想让构建失败,你可以在你想要验证代码风格的项目中使用Microsoft.CodeAnalysis.CSharp.CodeStyle NuGet package。如果代码不符合.editorconfig,这将生成构建失败。More informations in about this issue.
https://stackoverflow.com/questions/60436574
复制相似问题