All rules
CA1725Naming Enabled by default: No

Parameter names should match base declaration

Parameter names should match base declaration

Microsoft docs

Description

Consistent naming of parameters in an override hierarchy increases the usability of the method overrides. A parameter name in a derived method that differs from the name in the base declaration can cause confusion about whether the method is an override of the base method or a new overload of the method.

Cause

The name of a parameter in a method override does not match the name of the parameter in the base declaration of the method or the name of the parameter in the interface declaration of the method.

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

How to fix violations

To fix a violation of this rule, rename the parameter to match the base declaration. The fix is a breaking change for callers who specify the parameter name.

Example

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

When to suppress

Do not suppress a warning from this rule except for visible methods in libraries that have previously shipped.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0