AsyncLinqExtensions.

Map<TSource, TResult>(IAsyncEnumerable<TSource>, Func<TSource, int, TResult>) Method

Summary

Projects each element of a sequence into a new form by incorporating the element's index.

Syntax

public static IAsyncEnumerable<TResult> Map<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, int, TResult> selector)

Type Parameters

Name Description
TSource The type of the elements of source.
TResult The type of the value returned by selector.

Parameters

Name Type Description
source IAsyncEnumerable<TSource> A sequence of values to invoke a transform function on.
selector Func<TSource, int, TResult> A transform function to apply to each source element; the second parameter of the function represents the index of the source element.

Return Value

Type Description
IAsyncEnumerable<TResult> An System.Collections.Generic.IAsyncEnumerable`1 whose elements are the result of invoking the transform function on each element of source.