CA1722: Identifiers should not have incorrect prefix

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Item Value
RuleId CA1722
Category Microsoft.Naming
Breaking change Breaking

Cause

An identifier has an incorrect prefix.

Rule description

By convention, only certain programming elements have names that begin with a specific prefix.

Type names do not have a specific prefix and should not be prefixed with a 'C'. This rule reports violations for type names such as 'CMyClass' and does not report violations for type names such as 'Cache'.

Naming conventions provide a common look for libraries that target the common language runtime. This consistency reduces the learning curve that's required for new software libraries and increases customer confidence that the library was developed by someone who has expertise in developing managed code.

How to fix violations

Remove the prefix from the identifier.

When to suppress warnings

Do not suppress a warning from this rule.

CA1715: Identifiers should have correct prefix