How to await IAsyncEnumerable without using await foreach
I want to load data from a JSON file, but it could also be gzipp’ed, so I want to over another method that would just call the method for loading the JSON.
However, without await foreach
, the method returns immediately, Dispose()
is called on my Stream
and I get an exception that the file has been closed.
Is there a nicer way to write this?