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

Transform Parameters refactoring

Last modified: 06 February 2025

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:

  • Encapsulate input parameters into a parameter object. The refactoring will create a new class with public fields or auto-properties corresponding to the selected input parameters.

  • Encapsulate return values and out parameters into a return object. The refactoring will create a tuple or a new class with public fields or auto-properties corresponding to the selected return components and output parameters.

  • Transform some of the return tuple components to out parameters and vice versa. The refactoring will extend the return tuple with the selected output values and create out parameters from unselected ones.

  • Encapsulate the input part of a ref parameter into a parameter object. The refactoring will replace the modifier with out for the unselected output values that correspond to ref parameters.

  • Encapsulate the output part of a ref parameter into a return tuple or object. The refactoring will remove the modifier for the unselected input values that correspond to ref parameters.

  • Encapsulate parameters and return values into a single parameter object. The refactoring will create additional writable fields or properties for return values that correspond to the selected return components and out parameters.

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:

JetBrains Rider. Transforming method's parameters