Hi all,
I have a collection of IEnumerables and each one has a different attribute values that corresponds to a different property on my business object. Here is a sample of the XML that I am querying against:
<SimpleData name="zip">60004</SimpleData>
<SimpleData name="name">ARLINGTON HEIGHTS</SimpleData>
<SimpleData name="state">IL</SimpleData>
<SimpleData name="countyname">COOK</SimpleData>
<SimpleData name="lat">42.1121336684356</SimpleData>
<SimpleData name="lon">-87.9736682731814</SimpleData>
I think my linq2xml lambda is close (after searching MSDN and SO) but I can't seem to tweak it just right:
string cityName = simpleData.Where(a => a.Attribute("name").Value == "name").Select(a => a.Value).ToString();
The value of cityName get's assigned to "System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String]" instead of ARLINGTON HEIGHTS
Any suggestions? Thanks