Skip to content

Proposal: add Join overload that returns a valueTuple #28747

Closed as duplicate

Description

@mariusGundersen

Similar to the Zip proposed in #20167 it would be useful to have a Join overload that returns a valueTuple.

A very simple implementation (but one that isn't good enough) would be:

public static IEnumerable<(T1, T2)> Join<T1, T2, TKey>(
    this IEnumerable<T1> left, 
    IEnumerable<T2> right, 
    Func<T1, TKey> leftKey, 
    Func<T2, TKey> rightKey)
    => left.Join(right, leftKey, rightKey, ValueTuple.Create);

It could then be used like this:

foreach(var (a, b) in listA.Join(listB, a => a.Id, b => b.Id))
{
    // ...
}

Activity

  1. transferred this issue fromdotnet/corefxon Feb 1, 2020
  2. added this to the 5.0 milestone on Feb 1, 2020
  3. added
    untriaged
    on Feb 23, 2020
  4. removed
    untriaged
    on Jun 24, 2020
  5. modified the milestones: 5.0.0, Future on Jun 24, 2020
  6. ghost closed this as completedon Nov 9, 2021
  7. ghost locked as resolved and limited conversation to collaborators on Dec 9, 2021
  8. added
    backlog-cleanup-candidate
    on Feb 18, 2022
  9. removed this from the Future milestone on Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionarea-System.Collectionsbacklog-cleanup-candidate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions