AsyncLinqExtensions.

Filter<TSource>(IAsyncEnumerable<TSource>, Func<TSource, int, bool>) Method

Summary

Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.

Syntax

public static IAsyncEnumerable<TSource> Filter<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate)

Type Parameters

Name Description
TSource The type of the elements of source.

Parameters

Name Type Description
source IAsyncEnumerable<TSource> An System.Collections.Generic.IAsyncEnumerable`1 to filter.
predicate Func<TSource, int, bool> A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

Return Value

Type Description
IAsyncEnumerable<TSource> An System.Collections.Generic.IAsyncEnumerable`1 that contains elements from the input sequence that satisfy the condition.