I have the following xml
<root>
<document>
<account>12</account>
<type name-"a">stuff</type>
<type name-"b">stuff</type>
</document>
<document>
<account>42</account>
<type name-"a">stuff</type>
<type name-"b">good stuff</type>
<type name-"c">good stuff</type>
</document>
</root>
I want to return using LINQ to XML a Document class object for each document in the xml for
the account value and type value where the type attribute name is “b” into the class
class Document {
public string Account { get; set; }
public string BType { get; set; }
}
I am not sure how I iterate over the types or whether you can be neater than that with a predicate
Thanks
Mark
Something like:
Alternatively: