TEnumerable.Aggregate<TSource,TAccumulate,TResult> Method

Overloads

Aggregate<TSource,TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

Aggregate<TSource,TAccumulate,TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate,TResult>)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

Aggregate<TSource,TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

Delphi
class function Aggregate<TSource,TAccumulate>(const source: IEnumerable<TSource>; const seed: TAccumulate; const func: Func<TAccumulate, TSource, TAccumulate>): TAccumulate

Type Parameters

TSource

The type of the elements of source .

TAccumulate

The type of the accumulator value.

Parameters

source
IEnumerable<TSource>

A sequence aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate, TSource, TAccumulate>

An accumulator function to be invoked on each element.

Returns

TAccumulate

The final accumulator value.

Exceptions

source or func is nil .

Aggregate<TSource,TAccumulate,TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate,TResult>)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

Delphi
class function Aggregate<TSource,TAccumulate,TResult>(const source: IEnumerable<TSource>; const seed: TAccumulate; const func: Func<TAccumulate, TSource, TAccumulate>; const resultSelector: Func<TAccumulate, TResult>): TResult

Type Parameters

TSource

The type of the elements of source .

TAccumulate

The type of the accumulator value.

TResult

The type of the resulting value.

Parameters

source
IEnumerable<TSource>

A sequence aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate, TSource, TAccumulate>

An accumulator function to be invoked on each element.

resultSelector
Func<TAccumulate, TResult>

A function to transform the final accumulator value into the result value.

Returns

TResult

The transformed final accumulator value.

Exceptions

source or func or resultSelector is nil .