Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use this procedure to perform the Extract Interface refactoring operation.
To use Extract Interface
Create a console application as described in the Example section.
For more information, see Creating Console Applications (Visual C#).
With the cursor positioned in MethodB, and click Extract Interface on the Refactor menu.
The Extract Interface dialog box appears.
You can also type the keyboard shortcut CTRL+R, I to display the Extract Interface dialog box.
You can also right-click the mouse, point to Refactor, and then click Extract Interface to display the Extract Interface dialog box.
Click Select All.
Click OK.
You see the new file, IProtoA.cs, and the following code:
using System; namespace TopThreeRefactorings { interface IProtoA { void MethodB(string s); } }
Example
To set up this example, create a console application named ExtractInterface, and then replace Program with the following code. For more information, see Creating Console Applications (Visual C#).
// Invoke Extract Interface on ProtoA.
// Note: the extracted interface will be created in a new file.
class ProtoA
{
public void MethodB(string s) { }
}