Lecture – XML Serialization Part 1

XML Serialization Part 1

Prerequisites

Uses Example fromĀ Topic – Creating a Single Table Database Object Storage

Summary

Demonstrates the basics of using the XMLSerializer to create XML representation of an object.

Video 

Reference Materials

public string asXML()
        {
            // XML Serializer used to convert class to XML
            XmlSerializer x = new XmlSerializer(this.GetType());
            
            // Store the XML using a StringWriter
            StringWriter writer = new StringWriter();
            x.Serialize(writer, this);
            // Return a String
            return writer.ToString();      
        }

Additional Information

COP 4834 Lectures Page