Linq.ToEnumerable - Dmitry-Bychenko/Amphisbaena GitHub Wiki
ToEnumerable
Convert ChannelReader<T> to IEnumerable<T>. Note, that the method is synchronous to be used with legacy code.
Declaration (has overloads)
public static IAsyncEnumerable<T> ToEnumerable<T>(this ChannelReader<T> reader,
ChannelParallelOptions options)
Example
using Amphisbaena;
using Amphisbaena.Linq;
...
int[] data = new int[] {1, 2, 3};
var q = data
.ToChannelReader()
.Select(x => x + 10)
.ToEnumerable();
foreach(int item in q.Configure(false))
Console.WriteLine(item);