Home > Refactorings > Refactorings – Remove Parameter

Refactorings – Remove Parameter

August 13th, 2010

Also known as Remove Unused Parameter. This refactoring removes an unused parameter from a method declaration, and updates all calls accordingly. It is very useful when a parameter is no longer used by the method body. A spurious parameter doesn’t cause any problems, and you probably might need it again later. But most of the time this is the wrong choice, because a parameter indicates information that is needed. In this case, a caller has to worry about what values to pass for a fictitious, unused parameter. By not removing the parameter you are making further work for everyone who uses the method.

Opposite:

The opposite of this refactoring is the Add Parameter refactoring.

Sample:

Refactor! Remove Parameter preview

Result:

Refactor! Remove Parameter preview

—–
Products: CodeRush Xpress, Refactor! Pro and free editions of Refactor!
Versions: all
VS IDEs: any
Updated: Sep/26/2010
ID: R012

Similar Posts: