试过这个:
myStructs = from MyObject s in MyObjects
join c in Categories on s.CategoryID equals c.Item1 && s.Stars equals c.Item2
select s;
但似乎我不能在加入中写下2个条件?我哪里错了?在SQL上也可以这样做......
答案 0 :(得分:2)
您需要匿名类型才能加入多个条件/字段:
myStructs = from s in MyObjects
join c in Categories
on new { s.CategoryID, s.Stars } equals new { CategoryID = c.Item1, Stars = c.Item2 }
select s;