Serializing Filtered Views

As mentioned, in ADO.NET both the DataSet object and the DataTable object implement the ISerializable interface, thus making themselves accessible to any .NET Framework serializers. Only the DataSet object, however, exposes additional methods (for example, WriteXml) to let you explicitly save the contents to XML. We’ll explore the various aspects of ADO.NET object serialization in the section “Binary Data Serialization,” on page 422.

In the meantime, let’s see how to extend the DataTable and DataView objects with the equivalent of a WriteXml method.

Serializing DataTable Objects

The .NET Framework does not allow you to save a stand-alone DataTable object to XML. (A stand-alone DataTable object is an object not included ...

Get Applied XML Programming for Microsoft® .NET 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.