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

Introduce Field refactoring

Last modified: 08 March 2021

Refactor | Introduce Field...

Ctrl+R, F

This refactoring allows you to create a new field based on a selected expression, initialize it with the expression or from the constructor, and replace occurrences of the expression in the current type with references to the newly introduced field.

In the example below, we use this refactoring to replace two occurrences of the same string with a new constant field:

JetBrains Rider: Introduce Field refactoring