The Extract Superclass refactoring allows you to quickly create a new superclass for a selected class. ReSharper analyses the selected class and detects the superclasses and interfaces it inherits from, as well as its members and methods that can be included in the new superclass. After extraction, the new superclass is created with the necessary members generated from the common members of the original class. The original class will be made to inherit from the new superclass. You can also choose to update references to the original class and replace them with references to the superclass (optionally).
To extract a superclass
- In the editor, place the caret at the name of the class to be used for extracting a superclass.
- Do one of the following:
- On the main menu, click ReSharper | Refactor | Extract Superclass.
- Right-click the method name and select Refactor | Extract Superclass in the context menu.
- Press Ctrl + Shift + R, and then select Extract Superclass.
The Extract Superclass dialog box opens.

- Type the name of the new superclass (extracted class).
- Specify the namespace for the extracted class.
- In the list, select the checkboxes for those members that will be included in the new class/interface. For each member you select, select the corresponding Make Abstract checkbox to make/keep the member abstract. Use Select All to quickly select all members.
- Members whose inclusion would result in a conflict are highlighted in red font. Mouse over the method for a popup explaining the source of conflict.
- Click Continue. If no conflicts are found, the extraction is performed immediately.
- After the class is generated, you are presented with the following dialog. You can optionally select to replace references of the original class with references to the extracted superclass (you can also do this at a later time with the Use Base Type where Possible refactoring.

See Also
Refactoring Code