首页 新闻 会员 周边 捐助

editorconfig 中如何配置 C# constant 变量的命名规范

0
悬赏园豆:30 [已解决问题] 解决于 2025-05-31 11:25

想配置为 constant 变量采用全部大写,请问如何在 .editorconfig 文件中编写这个命名规则?

dudu的主页 dudu | 高人七级 | 园豆:24691
提问于:2025-05-31 10:59
< >
分享
最佳答案
0

在 SO 上 Enforcing upper case for const under Visual Studio with editoconfig 的回答中找到了解决方法

# Constants are UPPERCASE
dotnet_naming_rule.constants_should_be_upper_case.severity = suggestion
dotnet_naming_rule.constants_should_be_upper_case.symbols = constants
dotnet_naming_rule.constants_should_be_upper_case.style = constant_style

dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = all_upper
dudu | 高人七级 |园豆:24691 | 2025-05-31 11:25
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册