ReSharper
 
Get ReSharper
You are viewing the documentation for an earlier version of ReSharper.

Extract Superclass refactoring

Last modified: 21 July 2022

ReSharper | Refactor | Extract | Extract Superclass…

To assign a shortcut, go to Tools | Options | Environment | Keyboard and find the ReSharper_ExtractSuperclass command.

This refactoring allows you to extract certain members from a selected class into a new base class. The original class will extend the created base class.

If the current type already implements any interfaces, those interfaces can also be extracted into the new interface.

If you want to create an abstract class, mark at least one of the extracted method abstract.

In the example below, we extract an abstract class Shape from the existing class Circle:

ReSharper. Extract Superclass (Base class) refactoring

This feature is supported in the following languages and technologies:

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by language section.