Run enumeration of IAsyncEnumerable twice not possible?
Once CountAsync has been run, the await foreach won't enumerate any item. Why?
It seems there is no Reset method on the AsyncEnumerator.
var count = await itemsToImport.CountAsync();
await foreach (var importEntity in itemsToImport)
{
// won't run
}
Source of data:
private IAsyncEnumerable<TEntity> InternalImportFromStream(TextReader reader)
{
var csvReader = new CsvReader(reader, Config);
return csvReader.GetRecordsAsync<TEntity>();
}