-2
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();
4

1 回答 1

9
var result1 = from collection in collections
              from item in collection
              select item;
于 2012-06-18T15:44:21.757 回答