//private static async Task<List<int[]>[]> FetchDataSets(int n) //{ // var lst1 = new List<int[]>(); // var lst2 = new List<int[]>(); // var tasks = Enumerable.Range(0, n) // .Select(row => GetRow(MatrixName.A, row)); // lst1 = (await Task.WhenAll(tasks)).ToList(); // tasks = Enumerable.Range(0, n) // .Select(row => GetRow(MatrixName.B, row)); // lst2 = (await Task.WhenAll(tasks)).ToList(); // return new List<int[]>[] // { // lst1, lst2 // }; //} private static async Task <int[]> GetRow(MatrixName matrixName, int rowNum) { var getRowUri = string.Format("http://numberservice.azurewebsites.net/api/numbers/{0}/row/{1}", matrixName.ToString(), rowNum); var resp = await client.GetAsync(getRowUri); if (!resp.IsSuccessStatusCode) { throw new Exception("Something wrong while Gettting Row: " + resp.ReasonPhrase); } var row = await resp.Content.ReadAsAsync <Response <int[]> >(); return(row.Value); }