public async Task <int> SimpleGoAsync() { var apiFetcherAsync = new ApiFetcherAsync(); return(await apiFetcherAsync.Fetch()); /* * var card = apiFetcherAsync.Fetch().Result; * Logger.Log($"SimpleGoAsync result: {card}"); */ }
public void MultiGoAsync() { var numTasks = 10; var tasks = new List <Task <int> >(); for (int i = 1; i < numTasks; i++) { var apiFetcherAsync = new ApiFetcherAsync(); var task = apiFetcherAsync.Fetch(); tasks.Add(task); } Task.WhenAll(tasks); }