XElement config = XElement.Parse(
@"<Response SessionId='BEDF38F9ADAB4F029404C69E49951E73' xmlns='http://schemas.sample.com/sample.xsd'>
<Status Success='true' Message='User is now logged in.' ErrorCode='0' />
<UserID>80077702-0</UserID>
</Response>");
string masterID = (string)config.Element("UserID")
How to get the value UserID from the UserID element?
Since the XML specifies
xmlns='http://schemas.sample.com/sample.xsd'you will need to get the value by prefixing the namespace to the element:If the
xmlnswas not part of the XML you could have done it directly usingconfig.Element("UserID").Value