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
  1. Place the caret at the name of an abstract class in the editor, in the File Structure window, in Class View or Object Browser.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Refactor | Convert | Abstract Class to Interface.
    • Press Ctrl+Shift+R, then click Convert Abstract Class to Interface.
  3. If no conflicts are identified, the abstract class is converted into an interface with the same name. At the same time, modifiers of methods are changed accordingly. Otherwise, resolve conflicts .

Consider the example below:

After applying the refactoring, the CacheManager class is converted into the CacheManager interface:

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

See Also