Pull Members Up refactoring
This refactoring helps to move type members and implemented interfaces from a derived type up the inheritance hierarchy to a base type. For example, if you have
MyDerivedClass : MyBaseClass, IMyInterface, this refactoring can help you move members of
IMyInterface or to any of their ancestors. The refactoring can also move the entire implementation of
MyBaseClass or any of its ancestors.
In the example below, we invoke the refactoring on
MyDerivedClass to add
void Foo() implemented there to
Pull members up
Select a type in one of the following ways:
In the editor, set the caret at the name of a type.
Select a type in the Solution Explorer.
Select a type in the File Structure window.
Do one of the following:
Press Ctrl+Shift+R and then choose Pull Members Up
Choosein the main menu.
The Pull Members Up dialog will open.
Select a destination base type from the list of available types. Base types are displayed as a reversed hierarchy where types from the top of the hierarchy are displayed as most inner nodes.
Select members and/or interfaces that you want to move. You can also click All Public to quickly select all public members and/or Dependent to select members that are referenced by other selected members, implement the selected interfaces, or override members in base classes.
For any member, you can select Make abstract (if applicable) to create an abstract member in the target base class and leave its implementation in the current class.
To apply the refactoring, click Next.
If no conflicts are found, JetBrains Rider performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.