7.12. Use XML Serialization with Custom Objects
You need to use XML as a serialization format. However, you don't want to process the XML directly in your code. Instead, you want to interact with the data using custom objects.
Use the System.Xml.Serialization.XmlSerializer class to transfer data from your object to XML, and vice versa. You can also mark up your class code with attributes to customize its XML representation.
How It Works
The XmlSerializer class allows you to convert objects to XML data, and vice versa. This process is used natively by web services and provides a customizable serialization mechanism that does not require a single line of custom code. The XmlSerializer class is even intelligent enough to correctly ...