Chapter 7. Fields

A field is a variable that is associated with a class or with an instance of a class, and the set of fields contained with a class collectively represent an object's state. In this chapter, we'll explore the definition and use of fields, how to expose your fields to other classes directly and through properties, and the different modifiers you can use to change the way that your field works.

Fields are really important; they are at the heart of classes and are closely related to properties and methods (which I cover in Chapters 8 and 9, respectively). Without fields, we'd have no way to differentiate objects from one another and no basis on which to reflect the progression of our programs. Table 7-1 provides the summary for this ...

Get Introducing Visual C# 2010 now with O’Reilly online learning.

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