ReSharper Web Help

The Convert Abstract Class to Interface refactoring allows you to convert an abstract class to an interface. This is especially useful when you want a class to inherit from more than one abstract class, thus you need to convert one of them to an interface. The reverse functionality is available with the Convert Interface to Abstract Class refactoring.

To turn a suitable abstract class method into an interface
  • Right-click the name of an abstract class in Class View, Object Browser, or the code editor, and select Refactor | Convert Abstract Class to Interface from the pop-up menu.
  • Select ReSharper | Refactor | Convert | Abstract Class to Interface in the main menu.

If no conflicts are identified, the abstract class is converted into an interface of the same name. At the same time, modifiers of methods are changed accordingly.

Consider the following example:

After converting FormatterClass to an interface, the code looks as follows:

You can change the name of the newly formed interface using the  Rename refactoring.

See Also