CA1707: Identifiers should not contain underscores

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here

For the latest documentation on Visual Studio, see CA1707: Identifiers should not contain underscores.

TypeName IdentifiersShouldNotContainUnderscores
CheckId CA1707
Category Microsoft.Naming
Breaking Change Breaking - when raised on assemblies

Non-breaking - when raised on type parameters

Cause

The name of an identifier contains the underscore (_) character.

Rule Description

By convention, identifier names do not contain the underscore (_) character. The rule checks namespaces, types, members, and parameters.

Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve that is 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 all underscore characters from the name.

When to Suppress Warnings

Do not suppress a warning from this rule.

CA1709: Identifiers should be cased correctly

CA1708: Identifiers should differ by more than case