Why this matters
Changing parameter titles when implementing an interface or overriding a base method reduces readability and can confuse developers.
Verify that method parameters in overrides and interface implementations match the base method’s parameter titles to maintain consistency.
Changing parameter titles when implementing an interface or overriding a base method reduces readability and can confuse developers.
Side-by-side examples engineers can pattern-match during review.
interface IBankAccount
{
void AddMoney(int money);
}
class BankAccount : IBankAccount
{
void AddMoney(int amount) // Noncompliant: parameter's title differs from base
{
// ...
}
}interface IBankAccount
{
void AddMoney(int money);
}
class BankAccount : IBankAccount
{
void AddMoney(int money) // Compliant: parameter's title match base title
{
// ...
}
}interface IBankAccount
{
void AddMoney(int money);
}
class BankAccount : IBankAccount
{
void AddMoney(int amount) // Noncompliant: parameter's title differs from base
{
// ...
}
}interface IBankAccount
{
void AddMoney(int money);
}
class BankAccount : IBankAccount
{
void AddMoney(int money) // Compliant: parameter's title match base title
{
// ...
}
}From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.