Alt+Insert | Deconstructors
ReSharper helps you quickly generate overloads for the
Deconstruct method with selected members.
|Before generation||After generation|
| || |
To generate a deconstructor
- In the editor, set the caret on the type name or within a type at the line where you want to insert a deconstructor. If the caret is on the type name, the generated code will be added in the beginning of the type declaration.
- Press Alt+Insert or choose from the main menu. Alternatively, you can press Ctrl+Shift+A, start typing the command name in the pop-up, and then choose it there.
- In the Generate pop-up menu, select Deconstructors.
- In the Generate dialog that appears, select type members that should be used in the deconstructor.
- Click Finish to complete the wizard.
You can also click Options to review or modify common code generation preferences on the page of ReSharper options.
ReSharper also checks if a type contains the required deconstructor, and if not, suggests a quick-fix based on the tuple deconstruction.
This feature is supported in the following languages and technologies: