How to merge a list of lists with same type of items to a single list of items?
Use the SelectMany extension method
list = listOfList.SelectMany(x => x).ToList();
Here's the C# integrated syntax version:
var items =
from list in listOfList
from item in list
select item;
Do you mean this?
var listOfList = new List<List<int>>() {
new List<int>() { 1, 2 },
new List<int>() { 3, 4 },
new List<int>() { 5, 6 }
};
var list = new List<int> { 9, 9, 9 };
var result = list.Concat(listOfList.SelectMany(x => x));
foreach (var x in result) Console.WriteLine(x);
Results in: 9 9 9 1 2 3 4 5 6