AsyncCachingComparerWithTaskAndCancellation<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 class AsyncCachingComparerWithTaskAndCancellation<[System.Runtime.CompilerServices.Nullable(2)] TElement, [System.Runtime.CompilerServices.Nullable(2)] TKey> : AsyncCachingComparer<TElement>
{
[System.Runtime.CompilerServices.Nullable(new byte[] {
1,
1,
0,
1
})]
protected readonly Func<TElement, CancellationToken, ValueTask<TKey>> _keySelector;
protected readonly IComparer<TKey> _comparer;
protected readonly bool _descending;
protected TKey _lastKey;
public AsyncCachingComparerWithTaskAndCancellation([System.Runtime.CompilerServices.Nullable(new byte[] {
1,
1,
0,
1
})] Func<TElement, CancellationToken, ValueTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending)
{
_keySelector = keySelector;
_comparer = comparer;
_descending = descending;
_lastKey = default(TKey);
}
[System.Runtime.CompilerServices.NullableContext(0)]
[AsyncStateMachine(typeof(AsyncCachingComparerWithTaskAndCancellation<, >.<Compare>d__5))]
internal override ValueTask<int> Compare([System.Runtime.CompilerServices.Nullable(1)] TElement element, bool cacheLower, CancellationToken cancellationToken)
{
<Compare>d__5 stateMachine = default(<Compare>d__5);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<int>.Create();
stateMachine.<>4__this = this;
stateMachine.element = element;
stateMachine.cacheLower = cacheLower;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
[AsyncStateMachine(typeof(AsyncCachingComparerWithTaskAndCancellation<, >.<SetElement>d__6))]
internal override ValueTask SetElement(TElement element, CancellationToken cancellationToken)
{
<SetElement>d__6 stateMachine = default(<SetElement>d__6);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder.Create();
stateMachine.<>4__this = this;
stateMachine.element = element;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start<<SetElement>d__6>(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}