LINQ - Get all items in a List within a List?

后端 未结 4 898
梦如初夏
梦如初夏 2021-02-18 16:28

I\'m currently working my way through the learning curve that is LINQ and I could really use some assistance. I don\'t know if what I want is possible, but if I had to wager, I

4条回答
  •  日久生厌
    2021-02-18 17:21

    You don't need the where clause and you also shouldn't need to tell it what tab is

    And you will need to use SelectMany

    var indexes = (from tab in _tables).SelectMany(t => t.Indexes)
    

    Or you could do it like this

       var indexes = from tab in _tables
                      from t in tab.Indexes
                      select t;
    

    That should be a little more familiar syntaz

提交回复
热议问题