Select from following answers:- XElement customer = xElement.XPathSelectElements("/customer[@id='8']").FirstOrDefault();

- XElement customer = xElement.XPathSelectElements("//id['8']").FirstOrDefault()
- XElement customer = xElement.XPathSelectElements("/customer/@id='8'").FirstOrDefault();
- All Above
To use XPATH to retrieve the customer element with the id 8, call the XPathSelectElements extension method with the XPATH expression /customer[@id='8']. This expression locates the customer element with attribute id with value 8.
The XPATH expression /customer/@id='8' is incorrect because this is an invalid XPATH expression. Using this expression will throw a run-time exception.
Show Correct Answer
Source: MeasureUp.com | |
Alert Moderator