O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

17.9. Creating a Sequential-Access File Using Object Serialization

We begin by creating and writing serialized objects to a sequential-access file. In this section, we reuse much of the code from Section 17.5, so we focus only on the new features.

Defining the RecordSerializable Class

Let’s modify class Record (Fig. 17.8) so that objects of this class can be serialized. Class RecordSerializable (Fig. 17.13; part of the BankLibrary project) is marked with the [Serializable] attribute (line 7), which indicates to the CLR that RecordSerializable objects can be serialized. Classes that represent serializable types must include this attribute in their declarations or must implement interface ISerializable.

 1   // ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required