Naming Warnings
Naming warnings support adherence to the naming conventions of the .NET Framework Design Guidelines.
In This Section
Rule |
Description |
---|---|
This rule assumes that an enumeration member that has a name that contains "reserved" is not currently used but is a placeholder to be renamed or removed in a future version. Renaming or removing a member is a breaking change. |
|
The name of an event starts with "Before" or "After". To name related events that are raised in a specific sequence, use the present or past tense to indicate the relative position in the sequence of actions. |
|
A public enumeration has the System.FlagsAttribute attribute and its name does not end in "s". Types that are marked with FlagsAttribute have names that are plural because the attribute indicates that more than one value can be specified. |
|
The name of an externally visible identifier contains one or more words that are not recognized by the Microsoft spelling checker library. |
|
Identifiers for namespaces, types, members, and parameters cannot differ only by case because languages that target the common language runtime are not required to be case-sensitive. |
|
The name of an externally visible interface does not start with a capital "I". The name of a generic type parameter on an externally visible type or method does not start with a capital "T". |
|
The name of a parameter in an externally visible member contains a data type name, or the name of an externally visible member contains a language-specific data type name. |
|
By convention, only certain programming elements have names that begin with a specific prefix. |
|
By convention, only the names of types that extend certain base types or that implement certain interfaces, or types that are derived from these types, should end with specific reserved suffixes. Other type names should not use these reserved suffixes. |
|
Naming conventions dictate that a plural name for an enumeration indicates that more than one value of the enumeration can be specified at the same time. |
|
Consistent naming of parameters in an override hierarchy increases the usability of the method overrides. A parameter name in a derived method that differs from the name in the base declaration can cause confusion about whether the method is an override of the base method or a new overload of the method. |
|
A parameter name should communicate the meaning of a parameter, and a member name should communicate the meaning of a member. It would be a rare design where these were the same. Naming a parameter the same as its member name is unintuitive and makes the library difficult to use. |
|
CA1701: Resource string compound words should be cased correctly |
Each word in the resource string is split into tokens that are based on the casing. Each contiguous two-token combination is checked by the Microsoft spelling checker library. If recognized, the word produces a violation of the rule. |
A resource string contains one or more words that are not recognized by the Microsoft spelling checker library. |
|
Type names should not match the names of namespaces that are defined in the .NET Framework class library. Violation of this rule can reduce the usability of the library. |
|
By convention, identifier names do not contain the underscore (_) character. This rule checks namespaces, types, members, and parameters. |
|
The name of a public or protected member starts with "Get" and otherwise matches the name of a public or protected property. "Get" methods and properties should have names that clearly distinguish their function. |
|
A namespace name or a type name matches a reserved keyword in a programming language. Identifiers for namespaces and types should not match keywords that are defined by languages that target the common language runtime. |
|
The name of an externally visible identifier includes a term for which an alternative, preferred term exists. Alternatively, the name includes the term "Flag" or "Flags". |
|
By convention, parameter names use camel casing, and namespace, type, and member names use Pascal casing. |
|
The name of an identifier contains multiple words, and at least one of the words appears to be a compound word that is not cased correctly. |
|
Names of enumeration members are not prefixed with the type name because type information is expected to be provided by development tools. |
|
By convention, the names of types that extend certain base types or that implement certain interfaces, or types derived from these types, have a suffix that is associated with the base type or interface. |