次の方法で共有


CA1708: Identifiers should differ by more than case

Note

This article applies to Visual Studio 2015. 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
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 are converted to lowercase.

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 the .NET Framework.

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; }        
        }    
    }
}

CA1709: Identifiers should be cased correctly