// 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.Threading;
using System.Threading.Tasks;
namespace System.Linq
{
///
/// An iterator that supports random access and can produce a partial sequence of its items through an optimized path.
///
internal interface IAsyncPartition : IAsyncIListProvider
{
///
/// Creates a new partition that skips the specified number of elements from this sequence.
///
/// The number of elements to skip.
/// An with the first items removed.
IAsyncPartition Skip(int count);
///
/// Creates a new partition that takes the specified number of elements from this sequence.
///
/// The number of elements to take.
/// An with only the first items.
IAsyncPartition Take(int count);
///
/// Gets the item associated with a 0-based index in this sequence.
///
/// The 0-based index to access.
/// Token to observe for cancellation requests.
/// The element if found, otherwise, the default value of .
ValueTask> TryGetElementAtAsync(int index, CancellationToken cancellationToken);
///
/// Gets the first item in this sequence.
///
/// Token to observe for cancellation requests.
/// The element if found, otherwise, the default value of .
ValueTask> TryGetFirstAsync(CancellationToken cancellationToken);
///
/// Gets the last item in this sequence.
///
/// Token to observe for cancellation requests.
/// The element if found, otherwise, the default value of .
ValueTask> TryGetLastAsync(CancellationToken cancellationToken);
}
}