ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Transform Parameters refactoring

Last modified: 30 July 2024

This refactoring helps you quickly change method signature by transforming parameters — for example, get rid of out parameters, wrap parameters in a tuple or in a new class, and so on. — and automatically update all usages of the method in your solution.

The refactoring lets you perform the following transformations:

  • Create a new class with public fields or auto-properties for types corresponding to the selected parameters, and use the newly created class instead of parameters.

  • Replace parameters with a tuple object.

  • For a method returning void, transform a selected out parameter to method return.

  • For a method returning void, wrap multiple selected out parameters to a tuple object and use it as method return.

  • For a method returning void, create a new class with public fields or auto-properties for types corresponding to the selected out parameters, and use the newly created class as method return.

  • For non-void methods with out parameters, combine out parameters with return type in a tuple object or in a newly created class.

The example below demonstrates a mix of transformations - we replace out parameter with method return, and we wrap two other parameters with a new class:

ReSharper. Transforming method's parameters

This feature is supported in the following languages and technologies:

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the Languages and frameworks section.