// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information. 
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace System.Linq
{
    /// 
    /// An iterator that can produce an array or  through an optimized path.
    /// 
    public interface IAsyncIListProvider : IAsyncEnumerable
    {
        /// 
        /// Produce an array of the sequence through an optimized path.
        /// 
        /// 
        /// The array.
        ValueTask ToArrayAsync(CancellationToken cancellationToken);
        /// 
        /// Produce a  of the sequence through an optimized path.
        /// 
        /// 
        /// The .
        ValueTask> 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.
        ValueTask GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken);
    }
}