In the interest of completeness, the .Net 3.5 path should also be specified:
Assuming
XDocument doc = XDocument.Parse(@"<weather time-layout='k-p24h-n7-1'> <name>Weather Type, Coverage, and Intensity</name> <weather-conditions weather-summary='Mostly Sunny'/></weather>");
Then either
return doc.Element("weather").Element("weather-conditions").Attribute("weather-summary").Value;
or
return doc.Descendants("weather-conditions").First().Attribute("weather-summary").Value;
You will get the same answer.
source share