C#-Code // Create the serializer XmlSerializer serializer = new XmlSerializer(typeof(MySerializableType));
// Serialize the object to an XML file using (StreamWriter streamWriter = File.CreateText("CSXmlSerialization.xml")) { serializer.Serialize(streamWriter, instance); }
// Deserialize from a XML file to an object instance.
// Deserialize the object MySerializableType deserializedInstance; using (StreamReader streamReader = File.OpenText( "CSXmlSerialization.xml")) { deserializedInstance = serializer.Deserialize(streamReader) as MySerializableType; }