CSharp examples for System.Xml:XML String
XML string to object
// This program is free software: you can redistribute it and/or modify using System.Xml.Serialization; using System.Xml; using System.Text; using System.IO;//from w w w.j a v a2 s .c o m using System; public class Main{ /// <summary> /// XML string to object /// </summary> /// <param name="aXMLString">A valid XML string<</param>/ /// <param name="aType">Type of result</param> /// <returns>object</returns> public static object Deserialize(string aXMLString, Type aType) { XmlSerializer lSerializer = new XmlSerializer(aType); MemoryStream lMemStream = new MemoryStream((new UTF8Encoding()).GetBytes(aXMLString)); XmlTextWriter lWriter = new XmlTextWriter(lMemStream, Encoding.UTF8); return lSerializer.Deserialize(lMemStream); } }