I have an object structure I have deserialized from XML - but I'm wanting to use it with LINQ. Is there any way I can add this capability to a normal object structure without the hassle of XPath stuff?
+2
A:
If it's already deserialized, you can just use linq to objects. Otherwise you can use linq to xml, which is slightly more friendly than XPath.
Sander Rijken
2010-01-04 00:30:17
A:
Sure. There is no special requirements on the XML for linq to XML, you can easily use your serialised XML, simply use the classes from system.xml.linq
In particular XElement / XDocument.
i.e.
XElement xe = XElement.Parse(**yourXML**);
from x in xe.Descendants("someElement")
select .....
Tim Jarvis
2010-01-04 00:36:02