- Notifications
You must be signed in to change notification settings - Fork5.2k
Add GroupJoin overload returning IGrouping<TOuter, TInner>#121999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
| publicstaticSystem.Linq.IQueryable<TResult>GroupBy<TSource,TKey,TResult>(thisSystem.Linq.IQueryable<TSource>source,System.Linq.Expressions.Expression<System.Func<TSource,TKey>>keySelector,System.Linq.Expressions.Expression<System.Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult>>resultSelector,System.Collections.Generic.IEqualityComparer<TKey>?comparer){thrownull;} | ||
| publicstaticSystem.Linq.IQueryable<TResult>GroupBy<TSource,TKey,TElement,TResult>(thisSystem.Linq.IQueryable<TSource>source,System.Linq.Expressions.Expression<System.Func<TSource,TKey>>keySelector,System.Linq.Expressions.Expression<System.Func<TSource,TElement>>elementSelector,System.Linq.Expressions.Expression<System.Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult>>resultSelector){thrownull;} | ||
| publicstaticSystem.Linq.IQueryable<TResult>GroupBy<TSource,TKey,TElement,TResult>(thisSystem.Linq.IQueryable<TSource>source,System.Linq.Expressions.Expression<System.Func<TSource,TKey>>keySelector,System.Linq.Expressions.Expression<System.Func<TSource,TElement>>elementSelector,System.Linq.Expressions.Expression<System.Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult>>resultSelector,System.Collections.Generic.IEqualityComparer<TKey>?comparer){thrownull;} | ||
| publicstaticSystem.Linq.IQueryable<System.Linq.IGrouping<TOuter,TInner>>GroupJoin<TOuter,TInner,TKey>(thisSystem.Linq.IQueryable<TOuter>outer,System.Collections.Generic.IEnumerable<TInner>inner,System.Linq.Expressions.Expression<System.Func<TOuter,TKey>>outerKeySelector,System.Linq.Expressions.Expression<System.Func<TInner,TKey>>innerKeySelector){thrownull;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@copilot you missed the optional IEqualityComparer parameter here. Please add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Added theIEqualityComparer<TKey>? comparer parameter overloads for bothEnumerable.GroupJoin andQueryable.GroupJoin in commitd8cc66d.
| publicstaticSystem.Collections.Generic.IEnumerable<TResult>GroupBy<TSource,TKey,TResult>(thisSystem.Collections.Generic.IEnumerable<TSource>source,System.Func<TSource,TKey>keySelector,System.Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult>resultSelector,System.Collections.Generic.IEqualityComparer<TKey>?comparer){thrownull;} | ||
| publicstaticSystem.Collections.Generic.IEnumerable<TResult>GroupBy<TSource,TKey,TElement,TResult>(thisSystem.Collections.Generic.IEnumerable<TSource>source,System.Func<TSource,TKey>keySelector,System.Func<TSource,TElement>elementSelector,System.Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult>resultSelector){thrownull;} | ||
| publicstaticSystem.Collections.Generic.IEnumerable<TResult>GroupBy<TSource,TKey,TElement,TResult>(thisSystem.Collections.Generic.IEnumerable<TSource>source,System.Func<TSource,TKey>keySelector,System.Func<TSource,TElement>elementSelector,System.Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult>resultSelector,System.Collections.Generic.IEqualityComparer<TKey>?comparer){thrownull;} | ||
| publicstaticSystem.Collections.Generic.IEnumerable<System.Linq.IGrouping<TOuter,TInner>>GroupJoin<TOuter,TInner,TKey>(thisSystem.Collections.Generic.IEnumerable<TOuter>outer,System.Collections.Generic.IEnumerable<TInner>inner,System.Func<TOuter,TKey>outerKeySelector,System.Func<TInner,TKey>innerKeySelector){thrownull;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@copilot likewise, this is missing an IEqualityComparer parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The IEqualityComparer parameter was already added in commitd8cc66d - see line 85 in the ref file.
eiriktsarpalis left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@copilot you forgot to add the corresponding IAsyncEnumerable overloads in the System.Linq.AsyncEnumerable project.
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Summary
This PR implements the approved API proposal from issue#120597 to add a simplified GroupJoin overload.
Approved API (Enumerable and Queryable):
This new overload removes the need to specify a result selector and returns
IGrouping<TOuter, TInner>where the Key is the outer element and the Elements are the correlated inner elements.Original prompt
This section details on the original issue you should resolve
<issue_title>[API Proposal]: Add a GroupJoin overload returning a tuple of joined entries.</issue_title>
<issue_description># Motivation and Background
GroupJoin currently forces users to pass in a result selector which determines the shape of the return type. In most basic usages, users project out to an anonymous type (or a tuple) which wraps the returned TInner and TOuters - this proposal adds an additional overload of GroupJoin that removes to need to specify a result selector, and returns a tuple. We expect this will cover and simplify a large majority of the use-cases.
This proposal mirrors the simplified Zip overload, and also#120596 for Join.
API Proposal
Usage