ReSharper
 
Get ReSharper
You are viewing the documentation for an earlier version of ReSharper.

Inline Variable refactoring

Last modified: 21 July 2022

ReSharper | Refactor | Inline | Inline…

Ctrl+R I (ReSharper_InlineVariable)

This refactoring allows you to replace all occurrences of a variable in the code with its initializer. Note that the refactoring should be only applied if the variable value stays unchanged after initialization.

In the example below, we use this refactoring to inline the reversed variable.

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 details specific to other languages, see corresponding topics in the ReSharper by language section.