Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: IEnumerable<ValueTuple<T, T>> ConsecutivePairs<T>(this IEnumerable<T>, bool)

Declaration

public static IEnumerable<ValueTuple<T, T>> ConsecutivePairs<T>(
    this IEnumerable<T> source,
    bool closed
)

Summary

Returns an enumeration of tuples containing all consecutive pairs of the elements.

Generic type parameters

TThis type parameter is not documented.

Parameters

this IEnumerable<T>source The input enumerable.
boolclosed If true, an additional pair containing the last and first element is included. For example, if the source collection contains { 1, 2, 3, 4 } then the enumeration contains { (1, 2), (2, 3), (3, 4) } if closed is false, and { (1, 2), (2, 3), (3, 4), (4, 1) } if closed is true.