4

下图显示了我在 Visual Studio 2017 中不断收到的警告:

在此处输入图像描述

我从某个网站上得到了这个,我尝试了各种各样的东西。有谁知道我怎样才能摆脱这个?

这是我的 .editorconfig 中与命名相关的部分:

###############################
# Naming Conventions          #
###############################

# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization               = pascal_case

dotnet_naming_style.camel_case_style.capitalization                = camel_case

dotnet_naming_style.I_prefix_style.required_prefix                 = I
dotnet_naming_style.I_prefix_style.capitalization                  = pascal_case

# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity  = warning
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols   = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style     = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds             = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities   = *
dotnet_naming_symbols.constant_fields.required_modifiers           = const

# Use PascalCase for public fields
dotnet_naming_rule.pascal_case_for_public_fields.severity          = warning
dotnet_naming_rule.pascal_case_for_public_fields.symbols           = public_fields
dotnet_naming_rule.pascal_case_for_public_fields.style             = pascal_case_style
dotnet_naming_symbols.public_fields.applicable_kinds               = field
dotnet_naming_symbols.public_fields.applicable_accessibilities     = public

# Interfaces must be PascalCase and have an I prefix
dotnet_naming_rule.interfaces_start_with_I.severity                = warning
dotnet_naming_rule.interfaces_start_with_I.symbols                 = any_interface
dotnet_naming_rule.interfaces_start_with_I.style                   = I_prefix_style
dotnet_naming_symbols.any_interface.applicable_accessibilities     = *
dotnet_naming_symbols.any_interface.applicable_kinds               = interface

# Classes, structs, methods, enums, events, properties, namespaces, delegates must be PascalCase
dotnet_naming_rule.general_naming.severity                         = warning
dotnet_naming_rule.general_naming.symbols                          = general
dotnet_naming_rule.general_naming.style                            = pascal_case_style
dotnet_naming_symbols.general.applicable_kinds                     = class,struct,enum,property,method,event,namespace,delegate
dotnet_naming_symbols.general.applicable_accessibilities           = *

# Everything else is camelCase
dotnet_naming_rule.everything_else_naming.severity                 = warning
dotnet_naming_rule.everything_else_naming.symbols                  = everything_else
dotnet_naming_rule.everything_else_naming.style                    = camel_case_style
dotnet_naming_symbols.everything_else.applicable_kinds             = *
dotnet_naming_symbols.everything_else.applicable_accessibilities   = *
4

1 回答 1

2
# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T'
dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T

你可以从这里得到一套很好的规则。

于 2019-05-15T08:36:27.763 回答