Using async await in foreach loop in C#

Here is an example of using async await in foreach loop in C#:

        public async Task DoSomethingInForeachAsync()
        {
            var collection = await YourListCallerMethodAsync();
            var tasks = new List<Task>();

            foreach (var item in collection)
            {
                var task = DoSomethingElseAsync(item);
                tasks.Add(task);
            }

            await Task.WhenAll();
        }