ReSharper
 
Get ReSharper
You are viewing the documentation for an earlier version of ReSharper.

Convert Property to Method(s) refactoring

Last modified: 20 March 2021

ReSharper | Refactor | Convert | Property to Method(s)…

ReSharper_Property2Function

This refactoring converts get and set accessors of properties into the corresponding methods and updates usages of the property accordingly in the current solution. You can apply this refactoring to properties with backing fields as well as to auto-properties.

In the example below, the refactoring converts an auto-property to getter and setter methods:

If you convert only one accessor of an auto-property to a method, the second accessor is converted to a property with a backing field.

Converting a property to methods with a ReSharper's refactoring

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 details specific to other languages, see corresponding topics in the ReSharper by language section.