Answer the question
In order to leave comments, you need to log in
How to get value from Task in c#
async Task<string> AccessTheWebAsync(int id)
{
HttpClient client = new HttpClient();
string fields = "photo_big";
Task<string> getStringTask = client.GetStringAsync("https://api.vk.com/method/users.get?uid=" + (string)ApplicationData.Current.LocalSettings.Values["id"] + "&fields=" + fields);
string urlContents = await getStringTask;
return urlContents;
}
Answer the question
In order to leave comments, you need to log in
on tech days, it seems they recently posted a recording of a seminar on VS Day in the Kiev office of Microsof, there was a good lecture about asinka - from the series what it is and how to cook it, you go there. Sergei Baidachny read one of the lectures.
string s = await AccessTheWebAsync(123);
or string s = AccessTheWebAsync(123).Result;
. If the task has not completed, calling Result will block the current thread until the task completes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question