ReSharper 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. Position the caret at a member of the class that you want to pull members up from.
  2. Choose ReSharper | Refactor | Pull Members Up. The Pull Members Up wizard opens:
  3. Select a destination base type from the list of available types at the top of the wizard.
  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.

See Also

Procedures