How can the XML
contained in an XmlReader
instance be written to the immediate window in Visual Studio? Seems like ToString()
would do the trick, but it doesn't...
Do you want to debug XmlReader? From my experience it's easier to give up.
Dispite that you can call XDocument.Load(reader).ToString()
what will read the reader to its end thus make it further unusable. However you can initialize a new reader from resulting document. To make it easier write a helper method.
Try this:
reader.MoveToContent();
reader.ReadOuterXml();
But be aware that the XmlReader will not be usable any more.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.