Click or drag to resize
MoreEnumerableIncrementalTSource, TResult Method (IEnumerableTSource, FuncTSource, TSource, Int32, TResult)
Computes an incremental value between every adjacent element in a sequence: {N,N+1}, {N+1,N+2}, ...

Namespace: MoreLinq
Assembly: MoreLinq (in MoreLinq.dll) Version: 2.0.0
Syntax
public static IEnumerable<TResult> Incremental<TSource, TResult>(
	this IEnumerable<TSource> sequence,
	Func<TSource, TSource, int, TResult> resultSelector
)

Parameters

sequence
Type: System.Collections.GenericIEnumerableTSource
The sequence of elements to incrementally process
resultSelector
Type: SystemFuncTSource, TSource, Int32, TResult
A projection applied to each pair of adjacent elements in the sequence

Type Parameters

TSource
The type of the elements in the source sequence
TResult
The type of the elements in the result sequence

Return Value

Type: IEnumerableTResult
A sequence of elements resulting from projection every adjacent pair

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTSource. 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
The projection function is passed the previous element, next element, and the zero-based index of the next element (in that order) and may use any of these values in computing the result.
If the sequence has less than two items, the result is always an empty sequence.
The number of items in the resulting sequence is always one less than in the source sequence.
See Also