using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace System.Linq { /// /// An iterator that can produce an array or through an optimized path. /// interface IIListProvider : IAsyncEnumerable { /// /// Produce an array of the sequence through an optimized path. /// /// /// The array. Task ToArrayAsync(CancellationToken cancellationToken); /// /// Produce a of the sequence through an optimized path. /// /// /// The . Task> ToListAsync(CancellationToken cancellationToken); /// /// Returns the count of elements in the sequence. /// /// If true then the count should only be calculated if doing /// so is quick (sure or likely to be constant time), otherwise -1 should be returned. /// /// The number of elements. Task GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken); } }