s_records, q_records, d_records, i_records
类型为IEnumerable<MyRecord>
,querytwo
的所有类型均按预期工作。但是,如果我想在相同字段的相同相等性上加入多个IEnumerable
,该怎么办?
var querytwo = from a in s_records
join b in q_records
on a.date equals b.date
select new { s_line = a.line, q_line = b.line };
Console.WriteLine(querytwo.Count());
此query
无效,我尝试与querytwo
中的操作相同,但是要加入多个IEnumerable<MyRecord>
:
var query = from a in s_records
join b in q_records
join c in d_records
join d in i_records
on a.date equals b.date equals c.date equals d.date
select new { s_line = a.line, q_line = b.line, d_line = c.line, i_line = d.line };
答案 0 :(得分:2)
您的语法在某种程度上不正确。应该是:
var querytwo = from a in s_records
join b in q_records on a.date equals b.date
join c in d_records on b.date equals c.date
join d in i_records on c.date equals d.date
select new {
s_line = a.line,
q_line = b.line,
d_line = c.line,
i_line = d.line
};