Li‎‎‎‎‎‏‎‎‏‎‎‏‎‎‎‎‏‎‎‏‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‏‎‎‏‎‎‏‎‎‏‎‎‏‏‏‎‎‏‎‎‎‏‏‎‎‏‎‏‏‎‎‏‏‎‏‏‎‎‎‏‎‏‏‏‎‎‏‏‏‎‏‏nq To XML Inline Loop to add elements

Post date: Oct 19, 2009 2:47:23 PM

string[] consignments = {"Hej", "Jörgen", "Bye"}; var m = new XDocument( new XElement("instruction", new XElement("header", new XElement("version", "1.0"), new XElement("sender", new XAttribute("id", "5411"), new XAttribute("codelist", "30") ), new XElement("receiver", new XAttribute("id", "TEST"), new XAttribute("codelist", "30") ), new XElement("interchangetime", "Sep, 09 Sep 2008 10:04:07 +0100"), new XElement("interchangeid", "77"), new XElement("applicationid", "Back Office") ), new XAttribute("functioncode", "9"), from f in consignments select new XElement("consignment", f) ));