System.Linq.Async by .NET Foundation and Contributors

<PackageReference Include="System.Linq.Async" Version="6.0.1" />

.NET API 1,116,304 bytes

 OrderedAsyncEnumerableWithTaskAndCancellation<TElement, TKey>

using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace System.Linq { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal sealed class OrderedAsyncEnumerableWithTaskAndCancellation<[System.Runtime.CompilerServices.Nullable(2)] TElement, [System.Runtime.CompilerServices.Nullable(2)] TKey> : OrderedAsyncEnumerable<TElement> { private readonly IComparer<TKey> _comparer; private readonly bool _descending; [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 1, 0, 1 })] private readonly Func<TElement, CancellationToken, ValueTask<TKey>> _keySelector; [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] private readonly OrderedAsyncEnumerable<TElement> _parent; public OrderedAsyncEnumerableWithTaskAndCancellation(IAsyncEnumerable<TElement> source, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 1, 0, 1 })] Func<TElement, CancellationToken, ValueTask<TKey>> keySelector, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> comparer, bool descending, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] OrderedAsyncEnumerable<TElement> parent) : base(source) { if (keySelector == null) throw System.Error.ArgumentNull("keySelector"); _keySelector = keySelector; _comparer = (comparer ?? Comparer<TKey>.Default); _descending = descending; _parent = parent; } public override AsyncIteratorBase<TElement> Clone() { return new OrderedAsyncEnumerableWithTaskAndCancellation<TElement, TKey>(_source, _keySelector, _comparer, _descending, _parent); } internal override AsyncEnumerableSorter<TElement> GetAsyncEnumerableSorter([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken) { AsyncKeySelectorAsyncEnumerableSorterWithCancellation<TElement, TKey> asyncKeySelectorAsyncEnumerableSorterWithCancellation = new AsyncKeySelectorAsyncEnumerableSorterWithCancellation<TElement, TKey>(_keySelector, _comparer, _descending, next, cancellationToken); if (_parent != null) return _parent.GetAsyncEnumerableSorter(asyncKeySelectorAsyncEnumerableSorterWithCancellation, cancellationToken); return asyncKeySelectorAsyncEnumerableSorterWithCancellation; } internal override AsyncCachingComparer<TElement> GetComparer([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] AsyncCachingComparer<TElement> childComparer) { AsyncCachingComparer<TElement> asyncCachingComparer = (childComparer == null) ? new AsyncCachingComparerWithTaskAndCancellation<TElement, TKey>(_keySelector, _comparer, _descending) : new AsyncCachingComparerWithTaskAndCancellationAndChild<TElement, TKey>(_keySelector, _comparer, _descending, childComparer); if (_parent == null) return asyncCachingComparer; return _parent.GetComparer(asyncCachingComparer); } } }