You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with different APIs, often times it increases code readability to aggregate results and then linearize them. For example, I could write the code:
I'm assuming SelectMany() and Concat() are just alternative names for the same proposed method? Why not just stick with one? I personally would prefer exposing Concat() as an overload, since F# uses the same name for its equivalent method.
But you do have to choose between the fluent assymetric form and the non-fluent symmetric form. So I think the proposed overload of Concat would still be a good addition.
changed the title [-][API Proposal]: Add Enumerable.Concat overloads for variadic arguments and nested enumerables[/-][+][API Proposal]: Add Enumerable.Concat & Flatten overloads[/+]on Oct 21, 2021
It would be nice to have a Flatten() or parameterless SelectMany() implementation at least, as the current usage of nestedCollections.SelectMany(x => x);` never seems particularly intuitive or meaningful for me
I would like to add my voice to Flatten() or parameterless SelectMany() too. I think the old BCL was not support this because it lack contravariant feature? If so we now have contravariant it should be allowed?
Activity
eiriktsarpalis commentedon Jun 15, 2021
I'm assuming
SelectMany()andConcat()are just alternative names for the same proposed method? Why not just stick with one? I personally would prefer exposingConcat()as an overload, since F# uses the same name for its equivalent method.svick commentedon Jun 16, 2021
Note that another way to write this code is to use the existing overload of
Concat:Or:
But you do have to choose between the fluent assymetric form and the non-fluent symmetric form. So I think the proposed overload of
Concatwould still be a good addition.eiriktsarpalis commentedon Jun 16, 2021
Agreed, @TonyValenti if you could update the OP following the API proposal template we can consider this proposal for .NET 7.
danielchalmers commentedon Aug 12, 2021
I often make a
Flatten<T>(this IEnumerable<T> l)=>l.SelectMany(x=>x)extension so I would love to see this in the BCL!eiriktsarpalis commentedon Aug 13, 2021
@danielchalmers please consider upvoting the original post, it provides a good signal on whether a particular proposal is popular!
20 remaining items
[-][API Proposal]: Add Enumerable.Concat overloads for variadic arguments and nested enumerables[/-][+][API Proposal]: Add Enumerable.Concat & Flatten overloads[/+]eiriktsarpalis commentedon Nov 15, 2021
Changed to
api-needs-workdue to feedback in #61230. cc @stephentoubTahirAhmadov commentedon Nov 27, 2021
@bartonjs did you consider the solution I proposed here ?
LeaFrock commentedon Mar 23, 2023
No progress for .NET 8? Does
IQueryableblock it?JBrown526 commentedon Sep 17, 2024
It would be nice to have a
Flatten()or parameterlessSelectMany()implementation at least, as the current usage ofnestedCollections.SelectMany(x => x);` never seems particularly intuitive or meaningful for mejulealgon commentedon Sep 17, 2024
With collection literals and the spread operator, I assume this example would be completely nullified since you can just do:
Or am I missing something?
Thaina commentedon Sep 18, 2025
I would like to add my voice to
Flatten()or parameterlessSelectMany()too. I think the old BCL was not support this because it lack contravariant feature? If so we now have contravariant it should be allowed?