December 2004
Intermediate to advanced
1008 pages
21h 40m
English
XML serialization enables us to transform an instance of some class to XML and vice versa. Developers often need to perform XML serialization.
Listing 8.12 presents an example of XML serialization. In this example, there is a simple class that needs to be serialized: CellPhone. The first step is to create an instance of the class XmlSerializer and initialize is with the type XMLSerializationSample.CellPhone. Next, the CellPhone class is instantiated and the properties set to the desired values. Finally, the Serialize method is invoked and the CellPhone is serialized.
using System; using System.Xml.Serialization; namespace XMLSerializationSample { public ... |
Read now
Unlock full access