Refactorings for changing member signatures overview
This is just a quick list to organize a bunch of refactorings that change member signatures. Click the refactoring name to learn more about it.
Add Parameter
The refactoring adds a new parameter to a method declaration and updates all calls accordingly. This refactoring is useful when you need to quickly add a new parameter to an existing method because it needs more information from its caller that wasn’t passed in before.
Create Overload
The refactoring creates a new method or a constructor overload. It allows you to remove any number of parameters to create a new overload.
Decompose Parameter
The refactoring splits a single parameter into one or more parameters, depending on the function of the original parameter. It analyzes how the parameter is used and which of its properties are accessed, after which it can replace a single parameter into several others of the appropriate type for each property being accessed through the original parameter.
Introduce Parameter Object
The refactoring consolidates selected parameters into single object. If you frequently need to pass similar sets of values to methods that tend to be passed together, it might be useful to encapsulate these values into an object that carries all of this data.
Convert to Point
The refactoring is based on the Introduce Parameter Object refactoring with the difference that it doesn’t create a new object for parameters. Instead, it uses a ‘Point’ structure when there is a pair of two numeric parameters of a method definition selected.
Convert to Tuple
The refactoring is similar to the Introduce Parameter Object refactoring, but it doesn’t create a new object – it uses the built-in .NET Framework 4.0 Tuple object.
Convert to Size
The refactoring consolidates selected numeric parameters into a System.Drawing.Size (System.Windows.Size in WPF projects) or SizeF object. It might be useful to combine two parameters into a single parameter, reducing the overall number of method parameters and increasing code readability.
Make Extension
The refactoring converts a regular method into an extension method based on the selected parameter type. The extended type is taken from the parameter that you choose when applying the refactoring.
Make Member Non-static
The refactoring changes a static member to a regular instance member, and replace its references with a new class instance creation and with an appropriate call to the source member:
Make Member Static
The refactoring allows you to convert an instance member that can be made static into a static one. An instance member should not reference any other instance members to be static.
Promote to Parameter
The refactoring promotes local variables, field references and any primitive values into parameters and make the required updates to the code automatically.
Promote to Parameter (optional)
The refactoring promotes local variables, field references and any primitive values into optional parameters and make the required updates to the code automatically.
Remove 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.
Reorder Parameters
The refactoring allows you to reorder method parameters including its return value and update all method invocations appropriately.
Safe Rename
The refactoring creates a copy of a non-private method or property in the class in a manner that will not break any dependent code, such as code in third-party applications that use that member.
—– Products: CodeRush Pro Versions: 12.1 and up VS IDEs: 2008 and up Updated: Aug/09/2012 ID: R063