Identifiers should not have incorrect suffix
TypeName |
IdentifiersShouldNotHaveIncorrectSuffix |
CheckId |
CA1711 |
Category |
Microsoft.Naming |
Breaking Change |
Breaking |
Cause
An identifier has an incorrect suffix.
Rule Description
By convention, only the names of types that extend certain base types or that implement certain interfaces, or types derived from these types, should end with specific reserved suffixes. Other type names should not use these reserved suffixes.
The following table lists the reserved suffixes and the base types and interfaces they are associated with.
Suffix | Base type/Interface |
---|---|
Attribute |
|
Collection |
System.Collections.ICollection System.Collections.IEnumerable |
Dictionary |
|
EventArgs |
|
EventHandler |
An event-handler delegate. |
Exception |
|
Permission |
|
Queue |
System.Collections.Queue |
Stack |
System.Collections.Stack |
Stream |
In addition, the following suffixes should not be used:
Delegate
Enum
Flags for an enumeration
Impl
Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve required for new software libraries, and increases customer confidence that the library was developed by someone with expertise in developing managed code.
How to Fix Violations
Remove the suffix from the type name.
When to Exclude Warnings
Do not exclude a warning from this rule.
Related Rules
Identifiers should have correct suffix