I have method like that:
public async Task<IEnumerable<Model>> Get([FromUri]IList<string> links)
{
IList<Model> list = new List<Model>();
foreach (var link in links)
{
MyRequestAsync request = new MyRequestAsync(link);
list.Add(await request.GetResult());
}
return list;
}
But I am just wondering if it is really async
because I am thinking that part list.Add(await request.GetResult());
and return list;
breaking the async
nature of the method.
Please correct me if I am wrong and if I am right how can I fix that?
UPDATED: for my understanding I have to so something like that C# 5.0 async await return a list return await Task.Run(() => new List<string>() {"a", "b"});
but not sure how to apply that for my case.