Mega Code Archive

 
Categories / C# Tutorial / XML LINQ
 

Parse Load xml from hard coded string

using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Text;     class Program     {         static void Main(string[] args)         {             XElement xdoc = XElement.Parse(@"                     <customers>                       <customer ID=""A"">                         <order Item=""Widget"" Price=""100"" />                         <order Item=""Tire"" Price=""200"" />                       </customer>                     </customers>                     ");             Console.WriteLine(xdoc);         }     }