My XML is built like this:
<?xml version="1.0" encoding="utf-8" ?>
<Pages>
<Page id="1" title="myTitle">
Content
</Page>
<Page id="2" title="myTitle2">
Content2
</Page>
</Pages>
How can I get the content by ID in C# code?
I’d use LINQ to XML and something like:
Now
pagewill be the firstXElementwith the givenid, or null if it’s not found.