Export (0) Print
Expand All

Encapsulate Field Dialog Box 

Use this dialog box to specify settings for the Encapsulate Field refactoring operation.

Field name

Identifies the current name of the field for which a new property is generated.

Property name

Specifies the name of the new property that Encapsulate Field generates. The refactoring operation automatically generates a unique property name for you. However, you can change this name to any valid identifier.

NoteNote

If you enter a name that is an invalid identifier or conflicts with an existing name, an error will appear and refactoring will not proceed.

Update references:

Specifies where the refactoring engine automatically updates your code with references to the new property.

Option Description

External

Specifies that each reference to the field that is outside the enclosing type is replaced with a reference to the new property. Usages of the field within the enclosing type remain the same.

All

Specifies that every reference to the field is replaced with a reference to the new property.

NoteNote

Encapsulate Field will not update field references inside constructors.

Preview Reference Changes

Specifies that changes to the code will display in the Preview Changes — Encapsulate field dialog box before your code is modified.

Search in comments

Specifies that the refactoring engine will search code comments for references of the existing field to update.

Search in strings

Specifies that the refactoring engine will search string values for references of the existing field to update.

Remarks

When comments and strings are searched by the Encapsulate Field refactoring operation, the text is changed based on simple string matching in a global search and replace operation. To avoid errors, select Preview Reference Changes when Search in comments or Search in strings is selected.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft