A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1708 below:

CA1708: Identifiers should differ by more than case (code analysis) - .NET

Property Value Rule ID CA1708 Title Identifiers should differ by more than case Category Naming Fix is breaking or non-breaking Breaking Enabled by default in .NET 9 No 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.

How to fix violations

Select a name that's unique when it's 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.

Configure code to analyze

Use the following option to configure which parts of your codebase to run this rule on.

You can configure this option for just this rule, for all rules it applies to, or for all rules in this category (Naming) that it applies to. For more information, see Code quality rule configuration options.

Include specific API surfaces

You can configure which parts of your codebase to run this rule on, based on their accessibility, by setting the api_surface option. 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.CAXXXX.api_surface = private, internal

Note

Replace the XXXX part of CAXXXX with the ID of the applicable rule.

Example of a violation

The following example demonstrates a violation of this rule.

public class Class1
{
    protected string someName;
    public string SomeName => someName;
}

The following example shows one way to fix the violation

public class Class1
{
    protected string _someName;
    public string SomeName => _someName;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4