C#, how to create an XML document from an object?

Posted by JL on Stack Overflow See other posts from Stack Overflow or by JL
Published on 2010-03-30T21:02:28Z Indexed on 2010/03/30 21:13 UTC
Read the original article Hit count: 216

Filed under:

I have the following variable that accepts a file name:

var xtr = new XmlTextReader(xmlFileName)
              {
                  WhitespaceHandling = WhitespaceHandling.None
              };
var xd = new XmlDocument();
xd.Load(xtr);

I would like to change it so that I can pass in an object. I don't want to have to serialize the object to file first.

Is this possible?

© Stack Overflow or respective owner

Related posts about c#