Method ScanBy
View SourceScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, Func<TKey, TState>, Func<TState, TKey, TSource, TState>)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, TState> seedSelector, Func<TState, TKey, TSource, TState> accumulator)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, TKey> | keySelector | A function that returns the key given an element. |
Func<TKey, TState> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, TState> | accumulator | An accumulator function invoked for each element. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, ValueTask<TKey>>, Func<TKey, ValueTask<TState>>, Func<TState, TKey, TSource, ValueTask<TState>>)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TKey, ValueTask<TState>> seedSelector, Func<TState, TKey, TSource, ValueTask<TState>> accumulator)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, ValueTask<TKey>> | keySelector | A function that returns the key given an element. |
Func<TKey, ValueTask<TState>> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, ValueTask<TState>> | accumulator | An accumulator function invoked for each element. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken, ValueTask<TKey>>, Func<TKey, CancellationToken, ValueTask<TState>>, Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>>)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TKey, CancellationToken, ValueTask<TState>> seedSelector, Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>> accumulator)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, CancellationToken, ValueTask<TKey>> | keySelector | A function that returns the key given an element. |
Func<TKey, CancellationToken, ValueTask<TState>> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>> | accumulator | An accumulator function invoked for each element. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, Func<TKey, TState>, Func<TState, TKey, TSource, TState>, IEqualityComparer<TKey>?)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states. An additional parameter specifies the comparer to use to compare keys.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, TState> seedSelector, Func<TState, TKey, TSource, TState> accumulator, IEqualityComparer<TKey>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, TKey> | keySelector | A function that returns the key given an element. |
Func<TKey, TState> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, TState> | accumulator | An accumulator function invoked for each element. |
IEqualityComparer<TKey> | comparer | The equality comparer to use to determine
whether or not keys are equal. If null, the default equality
comparer for |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, ValueTask<TKey>>, Func<TKey, ValueTask<TState>>, Func<TState, TKey, TSource, ValueTask<TState>>, IEqualityComparer<TKey>?)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states. An additional parameter specifies the comparer to use to compare keys.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TKey, ValueTask<TState>> seedSelector, Func<TState, TKey, TSource, ValueTask<TState>> accumulator, IEqualityComparer<TKey>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, ValueTask<TKey>> | keySelector | A function that returns the key given an element. |
Func<TKey, ValueTask<TState>> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, ValueTask<TState>> | accumulator | An accumulator function invoked for each element. |
IEqualityComparer<TKey> | comparer | The equality comparer to use to determine
whether or not keys are equal. If null, the default equality
comparer for |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ScanBy<TSource, TKey, TState>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken, ValueTask<TKey>>, Func<TKey, CancellationToken, ValueTask<TState>>, Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>>, IEqualityComparer<TKey>?)
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states. An additional parameter specifies the comparer to use to compare keys.
Declaration
public static IAsyncEnumerable<(TKey key, TState state)> ScanBy<TSource, TKey, TState>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TKey, CancellationToken, ValueTask<TState>> seedSelector, Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>> accumulator, IEqualityComparer<TKey>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The source sequence. |
Func<TSource, CancellationToken, ValueTask<TKey>> | keySelector | A function that returns the key given an element. |
Func<TKey, CancellationToken, ValueTask<TState>> | seedSelector | A function to determine the initial value for the accumulator that is invoked once per key encountered. |
Func<TState, TKey, TSource, CancellationToken, ValueTask<TState>> | accumulator | An accumulator function invoked for each element. |
IEqualityComparer<TKey> | comparer | The equality comparer to use to determine
whether or not keys are equal. If null, the default equality
comparer for |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TKey key, TState state)> | A sequence of keys paired with intermediate accumulator states. |
Type Parameters
Name | Description |
---|---|
TSource | Type of the elements of the source sequence. |
TKey | The type of the key. |
TState | Type of the state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|
ArgumentNullException |
|