Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/fundamentals/code-analysis/quality-rules/ca1725.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ helpviewer_keywords:
- ParameterNamesShouldMatchBaseDeclaration
author: gewarren
ms.author: gewarren
dev_langs:
- CSharp
---
# CA1725: Parameter names should match base declaration

Expand All @@ -35,6 +37,10 @@ Consistent naming of parameters in an override hierarchy increases the usability

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

:::code language="csharp" source="snippets/csharp/all-rules/ca1725.cs" id="snippet1":::

## When to suppress warnings

Do not suppress a warning from this rule except for visible methods in libraries that have previously shipped.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace ca1725
{
//<snippet1>
public interface IUserService
{
int GetAge(int id);
}

public class UserService : IUserService
{
// Violates CA1725: Parameter name should match the base declaration ('id')
// for consistency with IUserService
public int GetAge(int userId)
{
throw new NotImplementedException();
}
}
//</snippet1>
}
Loading