Inline Class refactoring
This refactoring allows you to merge one class into another class. The class that you merge in is removed, its members are moved to the class where the merged class is used, and all usages of the merged class are updated accordingly.
In the example below, we merge the Painter
class (that is, its field myColor
and its method InitPainter
) into the Circle
class.
Inline a class
Place the caret at the name or a usage of a property or a field that represents the class that you want to merge in. Or, alternatively, select a property or a field in the File Structure window.
Do one of the following:
Press Control+Alt+N and then choose Inline Class
Press Control+Shift+R and then choose Inline Class
Right-click and choose Refactor | Inline Class in the context menu.
Choose
in the main menu.
If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
After applying the refactoring the property or the field is replaced with members of its type. All usages of the property or the field are updated accordingly.
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.