Linq.ElementAt - Dmitry-Bychenko/Amphisbaena GitHub Wiki

ElementAt

Element at given index in ChannelReader. InvalidOperationException is thrown if index is out of range.

Declaration (has overloads)

public static async Task<T> ElementAt<T>(this ChannelReader<T> reader,
                                              long index,
                                              ChannelParallelOptions options)

Example

using Amphisbaena;
using Amphisbaena.Linq;

...

int[] data = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9};

int item = await data
  .ToChannelReader()
  .ElementAt(4);