Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Linq CancelationToken parameters for async delegates #516

Open
timcassell opened this issue Jan 24, 2025 · 0 comments
Open

Async Linq CancelationToken parameters for async delegates #516

timcassell opened this issue Jan 24, 2025 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@timcassell
Copy link
Owner

timcassell commented Jan 24, 2025

Example, Where has

public static AsyncEnumerable<TSource> Where<TSource>(this AsyncEnumerable<TSource> source, Func<TSource, Promise<bool>> predicate);
public static AsyncEnumerable<TSource> Where<TSource, TCapture>(this AsyncEnumerable<TSource> source, TCapture captureValue, Func<TCapture, TSource, Promise<bool>> predicate);

But it's missing

public static AsyncEnumerable<TSource> Where<TSource>(this AsyncEnumerable<TSource> source, Func<TSource, CancelationToken, Promise<bool>> predicate);
public static AsyncEnumerable<TSource> Where<TSource, TCapture>(this AsyncEnumerable<TSource> source, TCapture captureValue, Func<TCapture, TSource, CancelationToken, Promise<bool>> predicate);

This is necessary to pass through the CancelationToken that is provided to AsyncEnumerable.GetAsyncEnumerator(CancelationToken) when the creator of the iterator has no control over how it's iterated (e.g. returning AsyncEnumerable<T> in a public API).

@timcassell timcassell added the enhancement New feature or request label Jan 24, 2025
@timcassell timcassell changed the title Async Linq add overloads with CancelationToken parameters for async delegates. Async Linq CancelationToken parameters for async delegates Jan 24, 2025
@timcassell timcassell added this to the v3.4.0 milestone Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant