Push Members Down refactoring
This refactoring helps move members and interface implementations from a base type to one or more direct inheritors of this type. For example, if you have class MyBaseClass : IMyInterface
and class MyDerivedClass : MyBaseClass
, this refactoring can help you move members of MyBaseClass
to MyDerivedClass
and/or move the entire implementation of IMyInterface
to MyDerivedClass
.
tip
The reverse functionality is available with the Pull Members Up refactoring refactoring.
Select a type in one of the following ways:
In the editor, place the caret at the name of a type.
Select a type in the Solution Explorer.
Select a type in the Structure window window.
Or, alternatively, select a member in the editor or in a tool window.
Do one of the following:
Press CtrlShift0R and then choose Push Members Down.
Choose Refactor | Push Members Down from the main menu.
The Push Members Down dialog will open.
Select one or more destination types from the list of inheritors.
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 or implement the selected interfaces.
For any member, you can select Make abstract (if applicable) to make the member abstract in the current class and create its implementation(s) in the target inheritor class(es).
To apply the refactoring, click Next.
If no conflicts are found, JetBrains Rider performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
tip
Right after the refactoring has been completed, all changes that it makes anywhere, including other files, are registered as a single operation. So you can use the Undo action Ctrl0Z to roll back all these changes with a single keystroke.
