Click or drag to resize

MoreEnumerableIncrementalTSource, TResult Method (IEnumerableTSource, FuncTSource, TSource, TResult)

Note: This API is now obsolete.

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.3.0
Syntax
[ObsoleteAttribute("Use Pairwise instead, which is identical to Incremental. Incremental will be removed in a future version.")]
public static IEnumerable<TResult> Incremental<TSource, TResult>(
	this IEnumerable<TSource> sequence,
	Func<TSource, TSource, TResult> resultSelector
)

Parameters

sequence
Type: System.Collections.GenericIEnumerableTSource
The sequence of elements to incrementally process
resultSelector
Type: SystemFuncTSource, TSource, 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 and next element (in that order) and may use either or both 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