Skip to content
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion _rules/1137.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
rule_id: 1137
rule_category: member-design
title: Define parameters as specific as possible
title: Keep parameters as specific and narrow as possible
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Keep" could be misinterpreted as "don't widen existing parameters, but for new parameters, it's fine".
The rule matters when defining (declaring) parameters.

severity: 2
---
If your method or local function needs a specific piece of data, define parameters as specific as that and don't take a container object instead. For instance, consider a method that needs a connection string that is exposed through a central `IConfiguration` interface. Rather than taking a dependency on the entire configuration, just define a parameter for the connection string. This not only prevents unnecessary coupling, it also improves maintainability in the long run.
Expand Down