Use ToString () to convert an XDocument to a string:
string result = string.Empty; XElement root = new XElement("xml", new XElement("MsgType", "<![CDATA[" + "text" + "]]>"), new XElement("Content", "<![CDATA[" + "Hi, this is Wilson Wu Testing for you! You can ask any question but no answer can be replied...." + "]]>"), new XElement("FuncFlag", 0) ); result = root.ToString();
Wilson Wu Apr 12 '13 at 9:45 a.m. 2013-04-12 09:45
source share