I am looking for a clean and short way to deserialize a XmlDocument
object. The closest thing I found was this but I am really wondering if there is no nicer way to do this (in .NET 4.5 or even 4.6) since I already have the XmlDocument.
So currently this looks as follows:
// aciResponse.Data is a XmlDocument
MyClass response;
using (XmlReader reader = XmlReader.Create((new StringReader(aciResponse.Data.InnerXml))))
{
var serializer = new XmlSerializer(typeof(MyClass));
response = (MyClass)serializer.Deserialize(reader);
}
Thanks for any better idea!
nicer
/cleaner
way? – Niemi