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