Transform XmlNode into XmlReader

I wonder what is the best way to turn a XmlNode object into an XmlReader... I could even name a few ways to do this ... But they use a MemoryStream to make the transformation.

XmlNode content = // My data
using (System.IO.MemoryStream mm = new System.IO.MemoryStream())
{
    using (System.Xml.XmlWriter wtr = System.Xml.XmlWriter.Create(mm))
    {
        content.WriteTo(wtr);
        wtr.Flush();
        mm.Position = 0;
        using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(mm))
        {
            // Here I have the object
        }
    }
}
Jon Skeet
people
quotationmark

Just use the XmlNodeReader constructor:

using (XmlReader reader = new XmlNodeReader(content))
{
    // ...
}

(The documentation says you should use XmlReader.Create - but there are no overloads taking an XmlNode, so that doesn't seem terribly useful to me...)

people

See more on this question at Stackoverflow