Closed ericwood8 closed 1 week ago
I believe this already exists in Visual Studio. If you press Ctrl+. with the caret on a type name, the menu has an option to extract an interface from a class.
If you find that there's something lacking in this experience, please open a new issue in https://github.com/dotnet/roslyn
Thanks!
Summary
Add a new menu option (on right-click menu) when I select a class that says "Extract Interface from Class" . When menu option clicked, create a new file Ixxx.cs that has a new interface in it with all the public methods of the selected class.
Skip over: 1) Skip properties. 2) Skip constructors. 3) Skip private or protected methods. 4) If inherited class, skip all inherited methods on parent class. Just do the selected child class' public methods.
Disable or hide the menu option: 1) If non-class.
2) If CS file has multiple classes in the CS file
If there is "Interface" or "Interfaces" folder in the selected CS file's project, then put the new interface file there.
User Impact
New user option