Andrew Laughlin
Andrew Laughlin

Reputation: 2032

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

Upvotes: 1

Views: 1106

Answers (2)

fcuesta
fcuesta

Reputation: 4520

Try this:

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

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

Upvotes: 2

abatishchev
abatishchev

Reputation: 100298

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.

Upvotes: 2

Related Questions