Chapter 15. Implementing properties to access fields

After completing this chapter, you will be able to:

This chapter looks at how to define and use properties to encapsulate fields and data in a class. Previous chapters emphasize that you should make the fields in a class private and provide methods to store values in them and to retrieve their values. This approach ensures safe and controlled access to fields and makes it possible for you to encapsulate additional logic and rules concerning the values that are permitted. However, the syntax ...

Get Microsoft Visual C# 2013 Step by Step 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.