SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method Interleave

    Interleave<T>(IAsyncEnumerable<T>, params IAsyncEnumerable<T>[])

    Interleaves the elements of two or more sequences into a single sequence, skipping sequences as they are consumed

    Declaration
    public static IAsyncEnumerable<T> Interleave<T>(this IAsyncEnumerable<T> source, params IAsyncEnumerable<T>[] otherSources)
    Parameters
    Type Name Description
    IAsyncEnumerable<T> source

    The first sequence in the interleave group

    IAsyncEnumerable<T>[] otherSources

    The other sequences in the interleave group

    Returns
    Type Description
    IAsyncEnumerable<T>

    A sequence of interleaved elements from all of the source sequences

    Type Parameters
    Name Description
    T

    The type of the elements of the source sequences

    Remarks

    Interleave combines sequences by visiting each in turn, and returning the first element of each, followed by the second, then the third, and so on. So, for example:

    {1,1,1}.Interleave( {2,2,2}, {3,3,3} ) => { 1,2,3,1,2,3,1,2,3 }
    This operator behaves in a deferred and streaming manner.
    When sequences are of unequal length, this method will skip those sequences that have been fully consumed and continue interleaving the remaining sequences.
    The sequences are interleaved in the order that they appear in the otherSources collection, with source as the first sequence.
    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    otherSources is null.

    ArgumentNullException

    Any of the items in otherSources is null.

    Interleave<T>(IEnumerable<IAsyncEnumerable<T>>)

    Interleaves the elements of two or more sequences into a single sequence, skipping sequences as they are consumed

    Declaration
    public static IAsyncEnumerable<T> Interleave<T>(this IEnumerable<IAsyncEnumerable<T>> sources)
    Parameters
    Type Name Description
    IEnumerable<IAsyncEnumerable<T>> sources

    The sequences to interleave together

    Returns
    Type Description
    IAsyncEnumerable<T>

    A sequence of interleaved elements from all of the source sequences

    Type Parameters
    Name Description
    T

    The type of the elements of the source sequences

    Remarks

    Interleave combines sequences by visiting each in turn, and returning the first element of each, followed by the second, then the third, and so on. So, for example:

    {1,1,1}.Interleave( {2,2,2}, {3,3,3} ) => { 1,2,3,1,2,3,1,2,3 }
    This operator behaves in a deferred and streaming manner.
    When sequences are of unequal length, this method will skip those sequences that have been fully consumed and continue interleaving the remaining sequences.
    The sequences are interleaved in the order that they appear in the sources collection.
    Exceptions
    Type Condition
    ArgumentNullException

    sources is null.

    © SuperLinq Authors. All rights reserved.