title | description | ms.date | ms.topic | author | ms.author | manager | ms.subservice | dev_langs | |
---|---|---|---|---|---|---|---|---|---|
Generate a deconstructor quick action |
Learn how to use the Quick Actions and Refactorings menu to immediately generate the method stub for a new deconstructor. |
02/19/2019 |
reference |
mikadumont |
midumont |
mijacobs |
general-ide |
|
This code generation applies to:
- C#
What: Lets you immediately generate the method stub for a new deconstructor.
When: You want to properly deconstruct your type automatically.
Why: You can manually type a deconstructor, but this feature generates the stub for you with the correct out parameters.
-
Declare a new type with the desired out parameters specified. This declaration will cause an error when no deconstruct instance matching your declaration can be found.
-
Take one of the following steps:
-
Keyboard
- With the cursor in your declaration, select Ctrl+. to trigger the Quick Actions and Refactorings menu.
-
Mouse
- Right-click and select the Quick Actions and Refactorings menu.
- Select the :::image type="icon" source="media/screwdriver.png"::: icon that appears in the left margin if the text cursor is already on the empty line in the class.
-
-
Select Generate method 'MyInternalClass.Deconstruct' to generate the deconstructor.