Accessing Encapsulate Field

The Encapsulate Field operation enables you to quickly generate properties from a given field. Properties, of course, enable you to protect the field from direct access and to know when the given field is being modified or accessed. To encapsulate a field, you position your cursor over the field and again press Ctrl+. to access the light bulb menu. Figure 9.23 shows an example.

Image

FIGURE 9.23 Encapsulate a field into a property from the Quick Actions menu.

An additional option on the Quick Actions menu for encapsulate field is the choice of the Usages Reference Field. This refers to existing references to the field. ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.