日期:2014-05-17 浏览次数:20486 次
string xml = @" <XML> <item ID=""2"" Name=""Coxwain"" /> <item ID=""7"" Name=""Electrician"" /> <item ID=""8"" Name=""High Voltage"" /> <item ID=""10"" Name=""HLO"" /> <item ID=""11"" Name=""Crane Driver"" /> <item ID=""12"" Name=""Rigging/ Slinging"" /> </XML> "; string [] val= XDocument.Load(new StringReader(xml)).Descendants("item").ToList().Select(c => c.Attribute("ID")+"|"+c.Attribute("Name") ).ToArray();