i'm new to async programming, i get the below warning in this method, does somebody knows why this happens? Thank you very much.
public async Task<List<T1>> StartSearchAsync()
{
....other code
searchRequests.ForEach(async s => {
products.AddRange(await SinglePageSearch(s));
});
return products;
}
warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
async. It's only used to enable you toawaitmethods in that particular method (StartSearchAsync()) . You are usingawaitin the delegate passed toForEach. - mm8List<T>.ForEach- Aluan Haddad