13.6. More on Fields

Now that we've gone into more detail on some of the generic collection classes available in the FCL, let's talk a little more about fields. Previous chapters of this book discussed fields, which are values or objects responsible for storing the data specific to a given object. In the earlier chapters, we glossed over some of the finer points. Let's now take a little time to flesh out a couple of the finer points about fields.

13.6.1. Initialization of Variables Revisited

We said back in Chapter 1 that trying to access local variables without explicitly initializing them will result in a compilation error. For example, this next bit of code

public class Example { static void Main() { // Declare several local variables within ...

Get Beginning C# 2008 Objects: From Concept to Code 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.