I have a function that returns IEnumerable<IEnumerable<string>>. I want to use this function, building on the basic IEnumerable, assigning it to a List<List<string>>. This would be easy if I just had one dimension (i.e. one collection), and would be solved by using the ToList() method – but how do i do this for an IEnumerable<IEnumberable<string>> without iterating through each of the items?
I have a function that returns IEnumerable<IEnumerable<string>> . I want to use this function,
Share
You could use Enumerable.SelectMany
For example(from MSDN)
Probably the best resource on this topic(J.Skeet):
Reimplementing LINQ to Objects: Part 9 – SelectMany
Here’s another example with a
List<List<string>>like in your question: