Extract Class From Parameters
The Extract Class From Parameters refactoring allows you to quickly create a new class or structure using (some of) the parameters of a given method. ReSharper analyses the selected method and detects the variables that can be converted into members. After extraction, the new class is created with the necessary fields generated from the selected method's parameters.
To extract a class from parameters
- In the editor, place the caret at the name of the method to be used.

- Do one of the following:
- On the main menu, click ReSharper | Refactor | Extract Class From Parameters.
- Right-click the method name and select Refactor | Extract Class From Parameters in the context menu.
- Press Ctrl + Shift + R, and then select Extract Class From Parameters.
The Extract Class From Parameters dialog box opens.

- Select whether you want to create a class or a structure
- Specify how you want to declare the new class or structure. Nested means that the class will be declared inside the selected method. Top-level means that the class will be declared inside the class in which this method is declarted.
- Type the new class name.
- In the list, select the checkboxes for those parameters that will be included in the new class/interface. Use Select All to quickly select all parameters.
- Click Continue. The new class is created in the same file, and its code looks like the following:

See Also
Refactoring Code