Skip to content

Proposal: New Zip LINQ Tuple Overload API #20167

@jcouv

Description

@jcouv

(By @agocke) Rewriting this issue to focus on exactly one API:

class System.Linq.Enumerable
{
    public static IEnumerable<(T1, T2)> Zip<T1, T2>(this IEnumerable<T1> first, IEnumerable<T2> second)
    {
        return first.Zip(second, (x, y) => (x, y));
    }
    // Already EXISTS:
    public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector);
}

There will also be a matching IQueryable API:

class System.Linq.Queryable
{
    public static IQueryable<(T1, T2)> Zip<T1, T2>(this IQueryable<T1 first, IQueryable<T2> second);
    // Already EXISTS:
    public static IQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IQueryable<TFirst> source1, IEnumerable<TSecond> source2, Expression<Func<TFirst, TSecond, TResult>> resultSelector);
}

[EDIT] Add class names and existing Zip method for context by @karelz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions