DEV Community

Gh M.
Gh M.

Posted on

Modern C#

await foreach (var item in GetDataAsync())
{
Console.WriteLine(item);
}

public async IAsyncEnumerable GetDataAsync()
{
yield return await GetData(1);
yield return await GetData(2);
...
}

Top comments (0)