Repository navigation
Add Linq method for getting value and index. - #95947
Conversation
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
|
Tagging subscribers to this area: @dotnet/area-system-linq Issue DetailsResolve #95563
|
eiriktsarpalis
left a comment
There was a problem hiding this comment.
There seem to be test failures in CI related to this change.
|
@eiriktsarpalis Thanks, I have updated my PR. |
| { | ||
| public static partial class Enumerable | ||
| { | ||
| /// <summary>Return index and the associated item.</summary> |
There was a problem hiding this comment.
This isn't an ideal description of what the method does: the method doesn't return an index and an associated item.
| /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> | ||
| /// <param name="source">An <see cref="IEnumerable{T}" /> to return an element from.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> | ||
| public static IEnumerable<(int Index, TSource Item)> Index<TSource>(this IEnumerable<TSource> source) |
There was a problem hiding this comment.
@eiriktsarpalis / @terrajobst, I see ~40 uses in source.dot.net of the Enumerable.Select overload that incorporates an index, 0 of which could switch to use this new method. Why do we believe it's valuable enough to ship?
Resolve #95563