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/ca1711 below:

CA1711: Identifiers should not have incorrect suffix (code analysis) - .NET

Property Value Rule ID CA1711 Title Identifiers should not have incorrect suffix Category Naming Fix is breaking or non-breaking Breaking Enabled by default in .NET 9 No Cause

An identifier has an incorrect suffix.

By default, this rule only looks at externally visible identifiers, but this is configurable.

Rule description

By convention, only the names of types that extend certain base types or that implement certain interfaces, or types derived from these types, should end with specific reserved suffixes. Other type names should not use these reserved suffixes.

The following table lists the reserved suffixes and the base types and interfaces with which they're associated.

In addition, the following suffixes should not be used:

Naming conventions provide a common look for libraries that target the .NET common language runtime. These conventions reduce the learning curve that's required for new software libraries and increase customer confidence that the library was developed by someone with expertise in developing managed code. For more information, see Naming guidelines: Classes, Structs, and Interfaces.

How to fix violations

Remove the suffix from the type name.

When to suppress warnings

Do not suppress a warning from this rule unless the suffix has an unambiguous meaning in the application domain.

Suppress a warning

If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.

#pragma warning disable CA1711
// The code that's violating the rule is on this line.
#pragma warning restore CA1711

To disable the rule for a file, folder, or project, set its severity to none in the configuration file.

[*.{cs,vb}]
dotnet_diagnostic.CA1711.severity = none

For more information, see How to suppress code analysis warnings.

Configure code to analyze

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

You can configure these options for just this rule, for all rules they apply to, or for all rules in this category (Naming) that they apply 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.

Allow suffixes

You can configure a list of allowed suffixes, with each suffix separated by the pipe character ("|"). For example, to specify that the rule should not run against Flag and Flags suffixes, add the following key-value pair to an .editorconfig file in your project:

dotnet_code_quality.ca1711.allowed_suffixes = Flag|Flags
See also

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