views:

205

answers:

3

How to split an IEnumerable of IEnumerables to one flat IEnumerable using LINQ (or someway else)?

+16  A: 
enumerable.SelectMany(x => x)
Mehrdad Afshari
+6  A: 
var result = from e in enumerables
             from v in e
             select v;
pdr
To abatishchev, this is functionally equivalent to Mehrdad's answer showing query expression sysntax versus extension methods and lambda expressions.
Anthony Pegram
A: 
IEnumerable<IEnumerable<int>> number_collections = ...
IEnumerable<int> = number_collections.SelectMany(x => x);
Jay
Downvote, really? This is the same as the accepted answer.
Jay