Sequence T  FoldRight Method A Sandcastle Documented Class Library
Folds the elements of this sequence using the specified accumulator function, going right to left. If this sequence represents an infinite set or series, this will never return!

Namespace: Sequences
Assembly: Sequences (in Sequences.dll) Version: 1.0.1.0 (1.0.1)
Syntax
public T FoldRight(
	T seed,
	Func<T, T, T> op
)

Parameters

seed
Type: T
The initial accumulator value. A neutral value for the fold operation (e.g., empty list, or 0 for adding the elements of this sequence, or 1 for multiplication).
op
Type: System Func T, T, T 
A function that takes an element of this sequence and the accumulator, and computes the new accumulator.

Return Value

Type: T
The result of applying op between all the elements and seed.

Implements

ISequence T  FoldRight(T, Func T, T, T )
Examples
int sum = Sequence.With(1,2,3,4).FoldRight(0, (a, b) => a + b);
See Also