All rules
CA1712Naming Enabled by default: No
Do not prefix enum values with type name
Do not prefix enum values with type name
Microsoft docsDescription
Names of enumeration members are not prefixed with the type name because type information is expected to be provided by development tools.
Naming conventions provide a common look for libraries that target the common language runtime. This reduces the time that is required for to learn a new software library, and increases customer confidence that the library was developed by someone who has expertise in developing managed code.
Cause
An enumeration contains a member whose name starts with the type name of the enumeration.
How to fix violations
To fix a violation of this rule, remove the type name prefix from the enumeration member.
Example
public enum DigitalImageMode
{
DigitalImageModeBitmap = 0,
DigitalImageModeGrayscale = 1,
DigitalImageModeIndexed = 2,
DigitalImageModeRGB = 3
}
public enum DigitalImageMode2
{
Bitmap = 0,
Grayscale = 1,
Indexed = 2,
RGB = 3
}When to suppress
Do not suppress a warning from this rule.
Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0