how do you flatten it?
With the SelectMany LINQ method, it's easy peasy:
var listOfLists = new List<IEnumerable<int>>() { Enumerable.Range(1, 3), Enumerable.Range(20, 3) };
listOfLists.Dump("List of lists");
listOfLists.SelectMany(lol => lol).Dump("Flat list");


No comments:
Post a Comment