spliff_vbulletin3_import8115
New Member
I have an \[code\]XML\[/code\] result like this \[code\]<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">16</int> </lst> <result name="response" numFound="3" start="0" maxScore="1.0"> <doc> <str name="ContaFirstname"> firstname1 </str> <str name="ContaId">6557</str> <str name="ContaJobTitle">Manager</str> <str name="ContaSurname">surname1 </str> </doc> <doc> <str name="ContaFirstname">firstname2</str> <str name="ContaId">6203</str> <str name="ContaJobTitle">Director</str> <str name="ContaSurname">surname2</str> </doc> </result></response>\[/code\]I want to get a list of objects, and every object will contain the value of \[code\]ContaFirstname\[/code\], \[code\]ContaId\[/code\], \[code\]ContaJobTitle\[/code\] and \[code\]ContaSurname\[/code\]I tried something like this, but that's not right because I get them all NULL\[code\]var test = from c in xml.Descendants("doc") select new { firstname = c.Element("ContaFirstname"), surnmane = c.Element("ContaSurname") }; \[/code\]So how can access these elements by name?