I’m trying to write a library for Windows Phone 8 and would like to know if its possible to consume JSON without using callbacks by using the await keyword? Or am I mistaken on how this works?
Essentially I want the app to be able to say:
string result = Library.Ping(var1, var2);
The library connects to the web service and deserializes the content from JSON to a dynamic object. Then it returns it to the main app that had sent the request to the library.
See for linked answer in case the website goes down:
Then you can write your function as:
And then call it as:
All credit goes to:
@robertftw who linked to: http://www.windowsphonegeek.com/news/windows-8—windows-phone-code-sharing-httpwebrequest-getresponseasync