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
  • Right-click the name of an interface in Class View, Object Browser, or in the code editor, and select Refactor | Convert Interface to Abstract Class in the pop-up menu.
  • Select ReSharper | Refactor | Convert | Interface to Abstract Class in the main menu.

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

Consider the following example:

After converting ICodeFormatter to an abstract class, the code looks as follows:

See Also

Procedures