ReSharper 8.0 Web Help

The Inline Parameter refactoring allows you to replace a method parameter with actual argument value from a method call.

To inline a parameter
  1. Place the caret at the parameter to be inlined.
  2. Do one of the following:
    • On the main menu, choose ReSharper| Refactor | Inline | Inline.
    • Choose Refactor | Inline | Inline on the context menu.
    • Press Ctrl+Alt+NCtrl+R,I.
  3. Depending on the values passed to the method for this parameter, the refactoring either applies immediately or you are prompted to provide additional information.
    • If a constant value is passed to the method, for example some numeric value, the method parameter is removed and all its occurrences within method body are replaced with this value.
    • If you have several method invocations and some of arguments are not constant, for example a property of an object, or you just have different kinds of arguments, ReSharper displays the Inline Parameter dialog box. Choose the value that should be used for replacement and specify whether to create new arguments.

For example, you want to restructure your code so that the UpdateSeverity method takes an object of the SeverityOption type as a parameter and then uses its Severity property.

Refactorings__Inline_Parameter_02

Invoke the refactoring at the argument and inline it.

Refactorings__Inline_Parameter_01

After applying the refactoring the value parameter of the Severity type is replaced with the severityOption parameter of the SeverityOption type.

Refactorings__Inline_Parameter_03


This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available

Tip

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.