How to convert this foreach loop into Linq code?

前端 未结 4 561
醉酒成梦
醉酒成梦 2021-01-03 11:21

I am new one with Linq and I would like to modify my old c# code to use Linq. The idea of this code to select all tables where it\'s not set and reference’s field PrimaryTab

4条回答
  •  Happy的楠姐
    2021-01-03 11:57

    Just need to use two from's

            var q = from table in dbServer.Tables
                    where !table.IsSet
                    from refer in table.References
                    where refer.PrimaryTable == "myTable"
                    select table;
    

提交回复
热议问题