// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT 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. /// /// /// This interface is primarily used for internal purposes as an optimization for LINQ operators. It was made public because /// it was defined in the System.Linq.Async package but also used in System.Interactive.Async. Now that /// System.Linq.Async is being retired in favor of .NET 10.0's System.Linq.AsyncEnumerable, the /// System.Interactive.Async package no longer takes a dependency on System.Linq.Async, and therefore defines /// its own version of this interface. We can't replace this with a type forwarder here because that would risk creating a /// circular dependency in cases where an application managed to get out-of-sync versions of the two packages. /// [Obsolete("This interface was always unsupported, and the IAsyncEnumerable LINQ implementation in System.Linq.AsyncEnumerable does not recognize it, so this no longer serves a purpose")] 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); } }