15.8. Course Modifications

There is only one minor change to be made to the Course class from the way that it was presented in Chapter 14, to accommodate our new file persistence scheme.

Because we're now reading in a predetermined section number from the SoC_SP2009.dat file, we must modify the ScheduleSection method of the Course class so that it no longer automatically assigns a "one-up" section number to each Section.

Here is the original code for the ScheduleSection method from Chapter 14; the highlighted code shows that we were automatically determining how many sections had already been created and stored in the offeredAsSection collection (a field of Course), and bumping that up by one to create a section number on the fly:

public Section ...

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.