var collecion = new List<List<ToTest>>
{
new List<ToTest>{new ToTest {Id = 1, Name = "some name"}, new ToTest {Id = 4, Name = "some name2"}},
new List<ToTest>{new ToTest {Id = 2, Name = "some name"}, new ToTest {Id = 5, Name = "some name2"}},
new List<ToTest>{new ToTest {Id = 3, Name = "some name"}, new ToTest {Id = 6, Name = "some name2"}},
};
我想使用功能性linq而不是lambda linq
var result1 = collecion.SelectMany(q => q).ToList();
答案 0 :(得分:9)
var result1 = from collection in collections
from item in collection
select item;