We have this method:
async Task AccessTheWebAsync() { HttpClient client = new HttpClient(); Task getStringTask = client.Get
No requires converting the Task to int. Simply Use The Task Result.
int taskResult = AccessTheWebAndDouble().Result; public async Task AccessTheWebAndDouble() { int task = AccessTheWeb(); return task; }
It will return the value if available otherwise it return 0.