I have a very simple XML:
<Rows>
<Row>
<id>1</id>
<name>foo</name>
<more>xyz</more>
</Row>
<Row>
<id>2</id>
<name>bar</name>
<more>abc</more>
</Row>
</Rows>
and need to do lots of querying on the ID, speed being really key.
Would it be more efficient loading the XML into a datatable and creating a PK on id and doing the querying on the data table?
or
Is this the most efficient Linq/Xml code?
myRows = XDocument.Parse(xmlString);
result = myRows.Element("Rows").Elements("Row").Single(r => r.Element("id").Value == "1");
if (result != null)
string name = result.Element("name").Value;
Edited For clarity: There are more elements than id & name.