Linq.SelectMany - Dmitry-Bychenko/Amphisbaena GitHub Wiki
Projects and flatten items within ChannelReader.
public static ChannelReader<T> SelectMany<T, S>(this ChannelReader<S> reader,
Func<S, long, ChannelReader<T>> selector,
ChannelParallelOptions options)using Amphisbaena;
using Amphisbaena.Linq;
...
int[][] data = new int[][] {
new int[] { 1, 2, 3 },
new int[] { 4 },
new int[] { 5, 6, 7, 8 },
new int[] { 9, 10},
};
int total = await data
.ToChannelReader()
.SelectMany(line => line.ToChannelReader())
.Aggregate((s, a) => s + a);