Populate XDocument from String

StevenMcD picture StevenMcD · Apr 14, 2009 · Viewed 139.2k times · Source

I'm working on a little something and I am trying to figure out whether I can load an XDocument from a string. XDocument.Load() seems to take the string passed to it as a path to a physical XML file.

I want to try and bypass the step of first having to create the physical XML file and jump straight to populating the XDocument.

Any ideas?

Answer

Ronald Wildenberg picture Ronald Wildenberg · Apr 14, 2009

You can use XDocument.Parse for this.