© Jonathan Hartwell 2017

Jonathan Hartwell, C# and XML Primer, 10.1007/978-1-4842-2595-0_4

4. Serialization

Jonathan Hartwell

(1)Joliet, Illinois, USA

There are times when your program is the only program handling the XML, such as a configuration file or some sort of XML datastore. In times like those, it can be tedious to use LINQ to XML or the XmlDocument to load, manipulate, and save your XML, especially since you know exactly what there is. If this is the case, then you can use serialization to save and read your XML. As I indicated earlier, this technique is only proper if you are the only one using this XML document.

Creating a Model

Before you are able to serialize your XML, there has to be a model first. Serialization is completely attribute ...

Get C# and XML Primer 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.