C# 私有字段前缀 _ 的设置(VS2019, .editorconfig)

  • 常量和静态只读字段大写
  • 私有字段前缀 _
#### Naming styles ####
# Naming rules
dotnet_naming_rule.const_should_be_all_upper.severity = suggestion
dotnet_naming_rule.const_should_be_all_upper.symbols = const
dotnet_naming_rule.const_should_be_all_upper.style = all_upper

dotnet_naming_rule.static_readonly_field_should_be_all_upper.severity = suggestion
dotnet_naming_rule.static_readonly_field_should_be_all_upper.symbols = static_readonly_field
dotnet_naming_rule.static_readonly_field_should_be_all_upper.style = all_upper

dotnet_naming_rule.private_or_internal_field_should_be_private_field.severity = suggestion
dotnet_naming_rule.private_or_internal_field_should_be_private_field.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_field.style = private_field

# Symbol specifications
dotnet_naming_symbols.const.applicable_kinds = field
dotnet_naming_symbols.const.applicable_accessibilities = *
dotnet_naming_symbols.const.required_modifiers = const

dotnet_naming_symbols.static_readonly_field.applicable_kinds = field
dotnet_naming_symbols.static_readonly_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_readonly_field.required_modifiers = readonly, static

dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.required_modifiers = 

# Naming styles
dotnet_naming_style.private_field.required_prefix = _
dotnet_naming_style.private_field.required_suffix = 
dotnet_naming_style.private_field.word_separator = 
dotnet_naming_style.private_field.capitalization = camel_case

dotnet_naming_style.all_upper.required_prefix = 
dotnet_naming_style.all_upper.required_suffix = 
dotnet_naming_style.all_upper.word_separator = _
dotnet_naming_style.all_upper.capitalization = all_upper

 

posted @ 2019-10-08 15:12  Bob-wei  阅读(1083)  评论(0编辑  收藏  举报