ReSharper Web Help

The Convert Interface to Abstract Class refactoring allows you to simplify a local hierarchical dependency among a set of classes and interfaces. This is especially useful when you no longer want a class to implement an interface, thus it makes sense to convert the interface to an abstract class and bring its methods into the new abstract class. The reverse functionality is provided by the Convert Abstract Class to Interface refactoring.

To turn a suitable interface into an abstract class
  1. Place the caret at the name of an interface 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 | Interface to Abstract Class
    • Press Ctrl+Shift+R, then click Convert Interface to Abstract Class.
  3. If no conflicts are identified, the interface is converted into an abstract class 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 interface is converted into an appropriate abstract class:

See Also

Procedures