MoreEnumerable.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>) Method

Applies four accumulators sequentially in a single pass over a sequence.

Definition

Namespace: MoreLinq
Assembly: MoreLinq (in MoreLinq.dll) Version: 4.4.0+6d97c3b1d482f98300f4446df14742b0e3fafbec
C#
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

source  IEnumerable<T>
The source sequence
seed1  TAccumulate1
The seed value for the first accumulator.
accumulator1  Func<TAccumulate1, T, TAccumulate1>
The first accumulator.
seed2  TAccumulate2
The seed value for the second accumulator.
accumulator2  Func<TAccumulate2, T, TAccumulate2>
The second accumulator.
seed3  TAccumulate3
The seed value for the third accumulator.
accumulator3  Func<TAccumulate3, T, TAccumulate3>
The third accumulator.
seed4  TAccumulate4
The seed value for the fourth accumulator.
accumulator4  Func<TAccumulate4, T, TAccumulate4>
The fourth accumulator.
resultSelector  Func<TAccumulate1, TAccumulate2, TAccumulate3, TAccumulate4, TResult>
A function that projects a single result given the result of each accumulator.

Type Parameters

T
The type of elements in source.
TAccumulate1
The type of first accumulator value.
TAccumulate2
The type of second accumulator value.
TAccumulate3
The type of third accumulator value.
TAccumulate4
The type of fourth accumulator value.
TResult
The type of the accumulated result.

Return Value

TResult
The value returned by resultSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

This operator executes immediately.

See Also