MoreEnumerableAggregateT, TAccumulate1, TAccumulate2, TResult(IEnumerableT, TAccumulate1, FuncTAccumulate1, T, TAccumulate1, TAccumulate2, FuncTAccumulate2, T, TAccumulate2, FuncTAccumulate1, TAccumulate2, TResult) Method

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

Definition

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

source  IEnumerableT
The source sequence
seed1  TAccumulate1
The seed value for the first accumulator.
accumulator1  FuncTAccumulate1, T, TAccumulate1
The first accumulator.
seed2  TAccumulate2
The seed value for the second accumulator.
accumulator2  FuncTAccumulate2, T, TAccumulate2
The second accumulator.
resultSelector  FuncTAccumulate1, TAccumulate2, 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.
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 IEnumerableT. 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