in Elastic.SemanticKernel.Connectors.Elasticsearch/Internal/Linq/AsyncEnumerable.cs [125:144]
public static ValueTask<bool> AnyAsync<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken = default)
{
Verify.NotNull(source);
Verify.NotNull(predicate);
return Core(source, predicate, cancellationToken);
static async ValueTask<bool> Core(IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
{
await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
{
if (predicate(item))
{
return true;
}
}
return false;
}
}