The Push Members Down refactoring helps push type members from a base type down the inheritance chain to an inheritor. This operation is useful when you want to specialize behavior in a certain type hierarchy.
ReSharper analyzes all members of the selected type and makes the list of members that you can push down. Before completing the refactoring, ReSharper also checks for possible conflicts, for example, whether the members you are trying to push down will be accessible in the destination type.
Reverse functionality is available with the Pull Members Up refactoring.
- Place the caret at any of the type members that you want to push down.
Do one of the following:
- On the main menu, choose ReSharper| Refactor | Push Members Down.
- Choose Refactor | Push Members Down on the context menu.
- Press Ctrl+Shift+RCtrl+Shift+R, then click Push Members Down.
The Push Members Down dialog box opens.
Select destination types from the list at the top of the dialog box.
Select members list, select members of the current type that you
want to push down. Optionally, click one of the following buttons:
- All Public to select all public members of the current type.
- Dependent to select members that are referenced by any other previously selected members.
- For any member, select Make abstract (if applicable) to make the original member abstract and move its implementation to the newly created overriding member.
- Click Next. If no conflicts are found, the refactoring is performed immediately. Otherwise, resolve conflicts.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.