System.Linq.Async by .NET Foundation and Contributors

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

.NET API 1,116,304 bytes

 OrderedAsyncEnumerableWithTask<TElement, TKey>

sealed class OrderedAsyncEnumerableWithTask<TElement, TKey> : OrderedAsyncEnumerable<TElement>
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 OrderedAsyncEnumerableWithTask<[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, ValueTask<TKey>> _keySelector; [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] private readonly OrderedAsyncEnumerable<TElement> _parent; public OrderedAsyncEnumerableWithTask(IAsyncEnumerable<TElement> source, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 1, 0, 1 })] Func<TElement, 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 OrderedAsyncEnumerableWithTask<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) { AsyncKeySelectorAsyncEnumerableSorter<TElement, TKey> asyncKeySelectorAsyncEnumerableSorter = new AsyncKeySelectorAsyncEnumerableSorter<TElement, TKey>(_keySelector, _comparer, _descending, next); if (_parent != null) return _parent.GetAsyncEnumerableSorter(asyncKeySelectorAsyncEnumerableSorter, cancellationToken); return asyncKeySelectorAsyncEnumerableSorter; } internal override AsyncCachingComparer<TElement> GetComparer([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] AsyncCachingComparer<TElement> childComparer) { AsyncCachingComparer<TElement> asyncCachingComparer = (childComparer == null) ? new AsyncCachingComparerWithTask<TElement, TKey>(_keySelector, _comparer, _descending) : new AsyncCachingComparerWithTaskAndChild<TElement, TKey>(_keySelector, _comparer, _descending, childComparer); if (_parent == null) return asyncCachingComparer; return _parent.GetComparer(asyncCachingComparer); } } }