Beispiel #1
0
            public async Task <(bool, T)> GetAsync(int pos, CancellationToken cancellationToken)
            {
                if (pos == -1)
                {
                    return(false, default(T));
                }
                if (Obtained.Count < pos)
                {
                    return(true, Obtained[pos]);
                }
                while (currentpos < pos)
                {
                    if (await en.MoveNext(cancellationToken).ConfigureAwait(false))
                    {
                        Obtained.Add(en.Current);
                        currentpos++;
                    }
                    else
                    {
                        return(false, default(T));
                    }
                }

                return(true, Obtained[pos]);
            }