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
- Place the caret at the name of an interface in the editor, in the File Structure window, in Class View or Object Browser.
- 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.
- 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,
Consider the example below:
After applying the refactoring, the
CacheManager interface is converted into an appropriate abstract class: