Method Scan
Scan<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>)
Performs a scan (inclusive prefix sum) on a sequence of elements. This operator is similar to Aggregate<TSource>(IEnumerable<TSource>, Func<TSource, TSource, TSource>) except that Scan<TSource>(IAsync
Declaration
public static IAsyncEnumerable<TSource> Scan<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> transformation)
Parameters
Type | Name | Description |
---|---|---|
IAsync |
source | Source sequence |
Func<TSource, TSource, TSource> | transformation | Transformation operation |
Returns
Type | Description |
---|---|
IAsync |
The scanned sequence |
Type Parameters
Name | Description |
---|---|
TSource | Type of elements in source sequence |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
Type | Condition |
---|---|
Argument |
|
Scan<TSource, TState>(IAsyncEnumerable<TSource>, TState, Func<TState, TSource, TState>)
Performs a scan (inclusive prefix sum) on a sequence of elements. This operator is similar to Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>) except that Scan<TSource, TState>(IAsync
Declaration
public static IAsyncEnumerable<TState> Scan<TSource, TState>(this IAsyncEnumerable<TSource> source, TState seed, Func<TState, TSource, TState> transformation)
Parameters
Type | Name | Description |
---|---|---|
IAsync |
source | Source sequence |
TState | seed | Initial state to seed |
Func<TState, TSource, TState> | transformation | Transformation operation |
Returns
Type | Description |
---|---|
IAsync |
The scanned sequence |
Type Parameters
Name | Description |
---|---|
TSource | Type of elements in source sequence |
TState | Type of state |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
Type | Condition |
---|---|
Argument |
|