roslyn:extract_interface
Extracts an interface from a class or struct by selecting all public instance members. Enables dependency injection and testability by generating interface code ready for insertion.
Instructions
Generate an interface from a class or struct. Extracts all public instance members (methods, properties, events).
USAGE: Position on class declaration, provide interfaceName="IMyService". OUTPUT: Generated interface code ready to insert. Useful for dependency injection and testability. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number (editor line - 1) | |
| column | Yes | Zero-based column number (editor column - 1) | |
| filePath | Yes | Absolute path to source file containing the class | |
| interfaceName | Yes | Name for the new interface (e.g., 'IMyService') | |
| includeMemberNames | No | Optional: specific member names to include (omit to include all public members) |