I am trying to build a Metro app that can get products off a Magento installation.
When I get to the login part in Visual Studio 2010 it works fine:
string sessionId = proxy.login("user", "pass");
However, when I try the same code in Visual Studio 11, it doesn’t give me the login option, rather the loginAsync, like so:
string sessionId = proxy.loginAsync("user", "pass");
If I use this option (which has the valid parameters of the regular “login”), VS11 gives me this error:
Cannot implicitly convert type
‘System.Threading.Tasks.Task’ to
‘string’
Any help would be greatly appreciated! Thank you.
Try using the
awaitmodifierEDIT
It looks like a lot of the APIs you’re using have gone from being synchronous to asynchronous. The asynchronous versions are coming back as
Task<string>instead of simplystring. Whenever that happens you have 2 options on how to get thestringor whatever data out of theTask<T>.awaiton the expression. This is non-blocking.Resulton the task. This is blocking