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

Encapsulate Field refactoring

Last modified: 25 September 2024

This refactoring allows you to create an auto-property or a property with the backing field from an existing field. Usages of the field are updated automatically.

In the example below, a field is replaced with an auto-property:

ReSharper. Encapsulate Field 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 more information about other languages, refer to corresponding topics in the Languages and frameworks section.