Search code examples
c#.netxmlvisual-studio-debuggingxmlreader

Write XmlReader XML to immediate window in Visual Studio?


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...


Solution

  • Try this:

    reader.MoveToContent();
    reader.ReadOuterXml();
    

    But be aware that the XmlReader will not be usable any more.