Method Aggregate
| Edit this page View SourceAggregate<T, TAccumulate1, TAccumulate2, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, Func<TAccumulate1, TAccumulate2, TResult>)
Applies two accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, Func<TAccumulate1, TAccumulate2, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
Func<TAccumulate1, TAccumulate2, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>)
Applies two accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2) Aggregate<T, TAccumulate1, TAccumulate2>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2) | A (T1, T2) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TResult>)
Applies three accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, Func<TAccumulate1, TAccumulate2, TAccumulate3, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>)
Applies three accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3) | A (T1, T2, T3) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2, T3)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult>)
Applies four accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>)
Applies four accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4) | A (T1, T2, T3, T4) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2, T3, T4)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TResult>)
Applies five accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>)
Applies five accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5) | A (T1, T2, T3, T4, T5) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2, T3, T4, T5)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TResult>)
Applies six accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>)
Applies six accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6) | A (T1, T2, T3, T4, T5, T6) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2, T3, T4, T5, T6)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>, TAccumulate7, Func<TAccumulate7, T, TAccumulate7>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TResult>)
Applies seven accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6, TAccumulate7 seed7, Func<TAccumulate7, T, TAccumulate7> accumulator7, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
TAccumulate7 | seed7 | The seed value for the seventh accumulator. |
Func<TAccumulate7, T, TAccumulate7> | accumulator7 | The seventh accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
TAccumulate7 | The type of the seventh accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>, TAccumulate7, Func<TAccumulate7, T, TAccumulate7>)
Applies seven accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6, TAccumulate7 seed7, Func<TAccumulate7, T, TAccumulate7> accumulator7)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
TAccumulate7 | seed7 | The seed value for the seventh accumulator. |
Func<TAccumulate7, T, TAccumulate7> | accumulator7 | The seventh accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7) | A (T1, T2, T3, T4, T5, T6, T7) containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
TAccumulate7 | The type of the seventh accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a (T1, T2, T3, T4, T5, T6, T7)
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8, TResult>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>, TAccumulate7, Func<TAccumulate7, T, TAccumulate7>, TAccumulate8, Func<TAccumulate8, T, TAccumulate8>, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8, TResult>)
Applies eight accumulators sequentially in a single pass over a sequence.
Declaration
public static TResult Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8, TResult>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6, TAccumulate7 seed7, Func<TAccumulate7, T, TAccumulate7> accumulator7, TAccumulate8 seed8, Func<TAccumulate8, T, TAccumulate8> accumulator8, Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8, TResult> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
TAccumulate7 | seed7 | The seed value for the seventh accumulator. |
Func<TAccumulate7, T, TAccumulate7> | accumulator7 | The seventh accumulator. |
TAccumulate8 | seed8 | The seed value for the eighth accumulator. |
Func<TAccumulate8, T, TAccumulate8> | accumulator8 | The eighth accumulator. |
Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8, TResult> | resultSelector | A function that projects a single result given the result of each accumulator. |
Returns
Type | Description |
---|---|
TResult | The value returned by |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
TAccumulate7 | The type of the seventh accumulator value. |
TAccumulate8 | The type of the eighth accumulator value. |
TResult | The type of the accumulated result. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>).
This operator uses multiple seeds and aggregates and passes the final values to resultSelector
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8>(IEnumerable<T>, TAccumulate1, Func<TAccumulate1, T, TAccumulate1>, TAccumulate2, Func<TAccumulate2, T, TAccumulate2>, TAccumulate3, Func<TAccumulate3, T, TAccumulate3>, TAccumulate4, Func<TAccumulate4, T, TAccumulate4>, TAccumulate5, Func<TAccumulate5, T, TAccumulate5>, TAccumulate6, Func<TAccumulate6, T, TAccumulate6>, TAccumulate7, Func<TAccumulate7, T, TAccumulate7>, TAccumulate8, Func<TAccumulate8, T, TAccumulate8>)
Applies eight accumulators sequentially in a single pass over a sequence.
Declaration
public static (TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8) Aggregate<T, TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8>(this IEnumerable<T> source, TAccumulate1 seed1, Func<TAccumulate1, T, TAccumulate1> accumulator1, TAccumulate2 seed2, Func<TAccumulate2, T, TAccumulate2> accumulator2, TAccumulate3 seed3, Func<TAccumulate3, T, TAccumulate3> accumulator3, TAccumulate4 seed4, Func<TAccumulate4, T, TAccumulate4> accumulator4, TAccumulate5 seed5, Func<TAccumulate5, T, TAccumulate5> accumulator5, TAccumulate6 seed6, Func<TAccumulate6, T, TAccumulate6> accumulator6, TAccumulate7 seed7, Func<TAccumulate7, T, TAccumulate7> accumulator7, TAccumulate8 seed8, Func<TAccumulate8, T, TAccumulate8> accumulator8)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source sequence |
TAccumulate1 | seed1 | The seed value for the first accumulator. |
Func<TAccumulate1, T, TAccumulate1> | accumulator1 | The first accumulator. |
TAccumulate2 | seed2 | The seed value for the second accumulator. |
Func<TAccumulate2, T, TAccumulate2> | accumulator2 | The second accumulator. |
TAccumulate3 | seed3 | The seed value for the third accumulator. |
Func<TAccumulate3, T, TAccumulate3> | accumulator3 | The third accumulator. |
TAccumulate4 | seed4 | The seed value for the fourth accumulator. |
Func<TAccumulate4, T, TAccumulate4> | accumulator4 | The fourth accumulator. |
TAccumulate5 | seed5 | The seed value for the fifth accumulator. |
Func<TAccumulate5, T, TAccumulate5> | accumulator5 | The fifth accumulator. |
TAccumulate6 | seed6 | The seed value for the sixth accumulator. |
Func<TAccumulate6, T, TAccumulate6> | accumulator6 | The sixth accumulator. |
TAccumulate7 | seed7 | The seed value for the seventh accumulator. |
Func<TAccumulate7, T, TAccumulate7> | accumulator7 | The seventh accumulator. |
TAccumulate8 | seed8 | The seed value for the eighth accumulator. |
Func<TAccumulate8, T, TAccumulate8> | accumulator8 | The eighth accumulator. |
Returns
Type | Description |
---|---|
(TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TAccumulate5, TAccumulate6, TAccumulate7, TAccumulate8) | A ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> containing the result of each accumulator. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in |
TAccumulate1 | The type of the first accumulator value. |
TAccumulate2 | The type of the second accumulator value. |
TAccumulate3 | The type of the third accumulator value. |
TAccumulate4 | The type of the fourth accumulator value. |
TAccumulate5 | The type of the fifth accumulator value. |
TAccumulate6 | The type of the sixth accumulator value. |
TAccumulate7 | The type of the seventh accumulator value. |
TAccumulate8 | The type of the eighth accumulator value. |
Remarks
This operator executes immediately.
Examples
For an example using a single seed and aggregate, please see Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>).
This operator uses multiple seeds and aggregates and returns the final values in a ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|