CA1708: Identifiers should differ by more than case

TypeName IdentifiersShouldDifferByMoreThanCase
CheckId CA1708
Category Microsoft.Naming
Breaking change Breaking

Cause

The names of two types, members, parameters, or fully qualified namespaces are identical when they're converted to lowercase.

By default, this rule only looks at externally visible types, members, and namespaces, but this is configurable.

Rule description

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. For example, Visual Basic is a widely used case-insensitive language.

This rule fires on publicly visible members only.

How to fix violations

Select a name that is unique when it is compared to other identifiers in a case-insensitive manner.

When to suppress warnings

Do not suppress a warning from this rule. The library might not be usable in all available languages in .NET.

Configurability

If you're running this rule from FxCop analyzers (and not with legacy analysis), you can configure which parts of your codebase to run this rule on, based on their accessibility. For example, to specify that the rule should run only against the non-public API surface, add the following key-value pair to an .editorconfig file in your project:

dotnet_code_quality.ca1708.api_surface = private, internal

You can configure this option for just this rule, for all rules, or for all rules in this category (Naming). For more information, see Configure FxCop analyzers.

Example of a violation

The following example demonstrates a violation of this rule.

using System;
namespace NamingLibrary
{    
    public class Class1	// IdentifiersShouldDifferByMoreThanCase    
    {        
        protected string someProperty;
 
        public string SomeProperty
        {            
            get { return someProperty; }        
        }    
    }
}