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

Add/Remove params modifier refactoring

Last modified: 23 September 2024

This refactoring allows you to improve APIs by introducing the params modifier to the last parameter of a collection type.

Consider an example of an API that accepts the array of types as the last argument:

Such API will force the consumers to construct arrays at the call site:

With this refactoring, you can improve this API ergonomics by adding the params modifier for Type[] types parameter and updating all usages.

With this refactoring, you can also perform the reverse transformation by removing the params modifier and updating the usages. This can be helpful ife you need to include new parameters after the last params parameter.

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.