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.1.0
Syntax [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
)
<ExtensionAttribute>
<ObsoleteAttribute("Use Index with Pairwise instead.Incremental will be removed in a future version.")>
Public Shared Function Incremental(Of TSource, TResult) (
sequence As IEnumerable(Of TSource),
resultSelector As Func(Of TSource, TSource, Integer, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
[ObsoleteAttribute(L"Use Index with Pairwise instead.Incremental will be removed in a future version.")]
generic<typename TSource, typename TResult>
static IEnumerable<TResult>^ Incremental(
IEnumerable<TSource>^ sequence,
Func<TSource, TSource, int, TResult>^ resultSelector
)
[<ExtensionAttribute>]
[<ObsoleteAttribute("Use Index with Pairwise instead.Incremental will be removed in a future version.")>]
static member Incremental :
sequence : IEnumerable<'TSource> *
resultSelector : Func<'TSource, 'TSource, int, 'TResult> -> IEnumerable<'TResult>
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:
IEnumerableTResultA 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