To extract an interface
- In the editor, position the caret at the declaration of interface or class that you want to extract an interface from.
On the main menu, choose
ReSharper | Refactor | Extract Interface.
Extract Interfacewizard opens:
Name of new interfacebox, type the name of a new interface or leave the default one.
Place besideor Place in another fileto define the physical location of the interface.
The list of members contains:
If you select the name of an interface that the refactored interface or class implements, it will be implemented in the extracted interface instead of the current class/interface. For example, if you refactor interface ICurrent that implements interface IImplemented, and you select the name of IImplemented in the list of members, then after the refactoring is completed, ICurrent will implement the newly created interface INew, which will in turn implement IImplemented.
- Members of the current class.
- Members of any base classes or interfaces that the selected class currently inherits/implements.
- Names of interfaces that the selected class currently implements.
- To extract all listed public members, click
- If you have selected members that reference other members, the latter are highlighted with red. Click
Dependentto resolve the conflict, i.e. to select any members that depend on the currently selected members.
Next. If no conflicts are found, the refactoring will be applied immediately, otherwise, resolve conflicts.