ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Inline Parameter refactoring

Last modified: 23 September 2024

This refactoring allows you to replace a method parameter with argument value from a method call. If there are several calls, you can choose the call to take the argument from.

A simple case. Inlining a constant value of the parameter pi:

If the argument that you want to be inlined depends on other variables and/or calculations, ReSharper can replace the original parameter with other parameter(s) and move the calculations inside the target method.

In the following example, we apply the refactoring to the action parameter of the PerformAction method so that the whole lambda, which was used as an argument in the call moves into the method body, and two new parameters are created to pass necessary values:

This feature is supported in the following languages and technologies:

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the Languages and frameworks section.