Serializar um Objecto para String (XML)

StringWriter sw =

new StringWriter();

XmlSerializer serializer = new XmlSerializer(typeof(OBJECT));

serializer.Serialize(sw, getAcessoryEquipmentsRequest.SearchCriteria);

strXML = sw.ToString();

Deserializar uma String (XML) para Objecto

StringReader sr =

new StringReader(strXML);

XmlSerializer serializer = new XmlSerializer(typeof(OBJECT));

obj = (OBJECT) serializer.Deserialize(sr);

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here