JetBrains Rider
 
2024.3
Get JetBrains Rider

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