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

Encapsulate Field refactoring

Last modified: 21 July 2022

ReSharper | Refactor | Encapsulate Field…

Ctrl+R E (ReSharper_EncapsulateField)

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