ReSharper 8.0 Web Help

The Pull Members Up refactoring helps pull type members from an inheritor up the inheritance hierarchy to a base type. This operation is useful when you want to generalize the behavior of the superclass.

ReSharper analyzes all members in the current class and makes the list of members that you can move to a superclass or interface. Before completing the refactoring, ReSharper also checks for possible conflicts, for example, whether the members you are trying to move to the base class will be accessible in the destination type.

Reverse functionality is available with the Push Members Down refactoring.

To pull members up
  1. Place the caret at a class that you want to pull members up from or at a particular member in the editor. In the latter case the member will be initially selected in the Pull Members Up dialog box.
  2. Do one of the following:
    • On the main menu, choose ReSharper| Refactor | Pull Members Up.
    • Choose Refactor | Pull Members Up on the context menu.
    • Press Ctrl+Shift+RCtrl+Shift+R, then click Pull Members Up.
  3. The Pull Members Up dialog box opens. Select a destination base type from the list of available types at the top of the dialog box.

    Refactorings__Pull_Members_Up__dialog_box

  4. In the Select members list, select members of the current type that you want to pull up. 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.
  5. For any member, select Make abstract (if applicable) to create an abstract member in the selected base type and leave its implementation in the current type.
  6. Click Next. If no conflicts are found, the refactoring is performed immediately. Otherwise, resolve conflicts.

Note

To further generalize behavior, consider using the Use Base Type Where Possible refactoring after pulling members up.

This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available

Tip

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.