Skip to content

Instantly share code, notes, and snippets.

@stevejgordon
Created October 14, 2020 08:39
Show Gist options
  • Save stevejgordon/7fdbf30a33a38a2c7ffb139705546627 to your computer and use it in GitHub Desktop.
Save stevejgordon/7fdbf30a33a38a2c7ffb139705546627 to your computer and use it in GitHub Desktop.
public virtual async IAsyncEnumerable<T> ReadAllAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
{
while (await WaitToReadAsync(cancellationToken).ConfigureAwait(false))
{
while (TryRead(out T item))
{
yield return item;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment