Advanced Serialization

You’ve seen how basic serialization is performed and controlled using attributes. But at times you’ll need more control over how an object or a collection of objects is serialized and deserialized. We’ll look at this next.

Customizing Serialization

You can influence the format of the serialization stream used to serialize an object by implementing the System.Runtime.Serialization.ISerializable interface. This is useful if you need to perform some additional or nonstandard processing as part of the serialization process. A large number of classes in the .NET Framework Class Library implement the ISerializable interface.

For example, consider the FileStream member variable in the Widget class discussed in the previous section. ...

Get Microsoft® Visual J#™ .NET (Core Reference) now with O’Reilly online learning.

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