Chapter 15. Implementing Properties to Access Fields

After completing this chapter, you will be able to:

  • Encapsulate logical fields by using properties.

  • Control read access to properties by declaring get accessors.

  • Control write access to properties by declaring set accessors.

  • Create interfaces that declare properties.

  • Implement interfaces containing properties by using structures and classes.

  • Generate properties automatically based on field definitions.

  • Use properties to initialize objects.

The first two parts of this book have introduced the core syntax of the C# language and have shown you how to use C# to build new types using structures, enumerations, and classes. You have also seen how the runtime manages the memory used by variables and objects ...

Get Microsoft® Visual C#® 2008 Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.