EDN Admin
Well-known member
Hi,
How do I read both attributes from an XML string in the same LINQ query? I can see how to create two
arrays but I would like to do this is one or even better into a List<>
Also, is there a better way of getting the attributes from an XML string than this?
<pre class="prettyprint String xml = @"<Ml><Mli LCID=9 Value=English /><Mli LCID=7 Value=German /></Ml>";
XDocument doc = XDocument.Parse(xml);
var values = (from f in doc.Elements().Descendants()
select f.Attribute("Value").Value).ToArray();
var values1 = (from f in doc.Elements().Descendants()
select f.Attribute("LCID").Value).ToArray();[/code]
<br/>
View the full article
How do I read both attributes from an XML string in the same LINQ query? I can see how to create two
arrays but I would like to do this is one or even better into a List<>
Also, is there a better way of getting the attributes from an XML string than this?
<pre class="prettyprint String xml = @"<Ml><Mli LCID=9 Value=English /><Mli LCID=7 Value=German /></Ml>";
XDocument doc = XDocument.Parse(xml);
var values = (from f in doc.Elements().Descendants()
select f.Attribute("Value").Value).ToArray();
var values1 = (from f in doc.Elements().Descendants()
select f.Attribute("LCID").Value).ToArray();[/code]
<br/>
View the full article