Refactoring - Extracting Interfaces

From RAD Studio
Jump to: navigation, search

Go Up to Refactoring Procedures Index


The following conditions should be met for extracting interfaces:

  • Only non-static methods can be extracted.
  • All methods in the extracted interface are public.
  • If the name specified for the new interface coincides with the name of an existing interface in the same namespace, all the methods will be extracted into an existing interface.

To extract an interface:

  1. Select one or more code elements (class, interface, field, method, event, property, or indexer) in the Code Editor or the Modeling's Diagram View or Model View.
  2. On the main menu, choose Refactor > Extract Interface.

    Tip: Alternatively, you can choose Refactor > Extract Interface on the context menu of the selection.

  3. In the Extract interface dialog box, enter the name for the interface and designate its namespace, if applicable.
  4. Specify the members to be used in the resulting interface by setting or clearing the respective check-boxes.
  5. Click OK. The Refactoring window opens allowing you to review the refactoring before committing to it.
  6. Click the Perform refactoring button to complete the extraction.

See Also