Imagine I have a list of classes that have the same async method, I can foreach on the list to do :
public async Task Test() { foreach (var runner in _runners) { await runner.Test(); } } but I can also do :
public void Test() { _runners.ForEach(async runner => await runner.Test()); } In this case, My test method isn't required to be async anymore. But will theses 2 methods have the same effect ?
ForEachdoes not work well with async lambdas.