共用方式為


CA1719: Parameter names should not match member names

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. 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
RuleId CA1719
Category Microsoft.Naming
Breaking change Breaking

Cause

The name of an externally visible member matches, in a case-insensitive comparison, the name of one of its parameters.

Rule description

A parameter name should communicate the meaning of a parameter and a member name should communicate the meaning of a member. It would be a rare design where these were the same. Naming a parameter the same as its member name is unintuitive and makes the library difficult to use.

How to fix violations

Select a parameter name that does not match the member name.

When to suppress warnings

For new development, no known scenarios occur where you must suppress a warning from this rule. For shipping libraries, you might have to suppress a warning from this rule.

CA1709: Identifiers should be cased correctly

CA1708: Identifiers should differ by more than case

CA1707: Identifiers should not contain underscores