Want to load or populate XDocument from a string in C# ? . Use the Parse method defined in the XDocument class as demonstrated below.
How to populate XDocument from a String in C# ?
using System; using System.Xml.Linq; namespace ACCode { class Program { static void Main(string[] args) { var input = "<Root>AC Code Input</Root>"; XDocument xdocument = XDocument.Parse(input); Console.WriteLine(xdocument); Console.ReadLine(); } } }
Leave a Reply