CSharp examples for System.Xml:XML Serialization
Load serialized object from XML
using System.Xml.Serialization; using System.Xml.Linq; using System.IO;/*from w w w . j a va 2 s.c om*/ public class Main{ public static T Load<T>(string path) { var doc = XDocument.Load(path); return Load<T>(doc); } public static T Load<T>(XDocument doc) { var serializer = new XmlSerializer(typeof(T)); var result = (T)serializer.Deserialize(doc.CreateReader()); return result; } }