New suffix is not mentioned in the CA1711 - Identifiers should not have incorrect suffix - page #45051
Labels
dotnet-fundamentals/svc
in-pr
This issue will be closed (fixed) by an active pull request.
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Type of issue
Missing information
Description
The New suffix is not mentioned in the article.
The code is the "NewSuffix" in:
https://github.com/dotnet/roslyn-analyzers/blob/main/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldNotHaveIncorrectSuffix.cs
I suggest adding a section on "New" under the Rule description section with something like "New should not be used as a suffix if there is another member with the same name minus the suffix as it implies the member replaces the other member"
For one of my enums I have two members "Attached" and "AttachedNew" and I get a warning: "CA1711 - Either replace the suffix 'New' in member name AttachedNew with the suggested numeric alternate '2' or provide a more meaningful suffix that distinguishes it from the member it replaces"
I was confused first why I was getting the error as my member does not replace the other member and was searching for any documentation on the "New" suffix. At first I thought maybe it was due to the reserved keyword "new".
Page URL
https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca1711
Content source URL
https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca1711.md
Document Version Independent Id
80a9b228-4707-b401-d96c-e07fe2b8514c
Article author
@gewarren
Metadata
Related Issues
Associated WorkItem - 402486
The text was updated successfully, but these errors were encountered: