C# deserialize xml error ReadElementContentAs() methods cannot be called on an element that has child elements
问题 I've looked at several similar SO questions but still can't solve my issue. Using the following code I try to deserialize: private static QCOrderInfo GetOrderFromXml(XDocument xmlDoc){ XmlSerializer serializer = new XmlSerializer(typeof(QCOrderInfo)); var post = (QCOrderInfo)serializer.Deserialize(xmlDoc.Root.CreateReader()); return post ?? new QCOrderInfo(); } The error resulting: System.Xml.XmlException: ReadElementContentAs() methods cannot be called on an element that has child elements.