CSharp examples for System.Xml:XML Serialization
Save To serialized Object
using System.Xml.Serialization; using System.Xml.Linq; using System.IO;//w w w. jav a 2 s .co m public class Main{ public static void SaveTo(object data, StreamWriter writer) { var serializer = new XmlSerializer(data.GetType()); serializer.Serialize(writer, data); } public static void SaveTo(object data, string path) { var writer = File.CreateText(path); SaveTo(data, writer); } }