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

Convert Method to Property refactoring

Last modified: 23 September 2024

This refactoring helps you convert methods with return values and without parameters to properties with the corresponding get accessor, and methods with void return type and exactly one parameter to properties with the corresponding set accessor.

Consider the following example:

If there is an existing property with a single accessor and the converted method has compatible parameter type or return type, the refactoring can add the second accessor to the existing property:

JetBrains Rider refactorings: Convert method to property dialog