[Proposal] Parameterless SelectMany() Overload for LINQ #8438
-
Add an overload to SelectMany() with no parameters to flatten nested collections: Currently to do this, you must call: List<List<T>> nested = [];
nested.SelectMany(i => i); It seems to me that having to add public static IEnumerable<TResult> SelectMany<TResult>(this IEnumerable<IEnumerable<TResult>> source)
{
// Implementation, essentially:
return source.SelectMany(i => i);
} Which would subsequently be used like so: List<List<T>> nested = [];
nested.SelectMany(); |
Beta Was this translation helpful? Give feedback.
Answered by
333fred
Sep 17, 2024
Replies: 2 comments 4 replies
-
I believe you're looking for dotnet/runtime, not this repository. API suggestions are here. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
JBrown526
-
You could also define one yourself: public static class SelecyManyExtensions {
public static IEnumerable<T> SelectMany<T>(this IEnumerable<IEnumerable<T>> items) {
return items.SelectMany(i => i);
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you're looking for dotnet/runtime, not this repository. API suggestions are here.