Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: IEnumerable<T> InsertBetween<T>(this IEnumerable<T>, T)

Declaration

public static IEnumerable<T> InsertBetween<T>(
    this IEnumerable<T> source,
    T extraElement
)

Summary

Inserts the specified item in between each element in the input collection.

Generic type parameters

TThis type parameter is not documented.

Parameters

this IEnumerable<T>source The input collection.
TextraElement The element to insert between each consecutive pair of elements in the input collection.

Returns

A collection containing the original collection with the extra element inserted. For example, new[] { 1, 2, 3 }.InsertBetween(0) returns { 1, 0, 2, 0, 3 }.