I am integrating with a REST service and so far so good.
Hit a little bit of a hurdle.
I am hitting the service via a HttpWebRequest.
I am receiving responses successfully, but in running the HttpWebResponse GetResponseStream through a StreamReader, i am getting back an
<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/">427</int>.
A little stuck on how to convert this back to a c# int.
Any advice?
Thanks.
You may take a look at the
int.Parseandint.TryParsemethods in conjunction with a XDocument which you could use to load the response XML into:or even easier, the Load method of XDocument understands HTTP, so you could even do this:
this way you don’t even need to use any HTTP requests/responses. Everything will be handled for you by the BCL which is kinda great.