Click or drag to resize

MoreEnumerableIncrementalTSource, TResult Method (IEnumerableTSource, FuncTSource, TSource, Int32, 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.4.0
[ObsoleteAttribute("Use Index with Pairwise instead.Incremental will be removed in a future version.")]
public static IEnumerable<TResult> Incremental<TSource, TResult>(
	this IEnumerable<TSource> sequence,
	Func<TSource, TSource, int, TResult> resultSelector


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

Type Parameters

The type of the elements in the source sequence
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).
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