3
我试图连接两个表的三列,我得到一个错误加盟:问题用简单的由多列在两个表中使用LINQ
error CS1941: The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
我不知道发生了什么事情。我检查了st_year
,st_month
,st_day
year
,month
和day
的类型,他们都是int
,所以我不应该得到错误。
的代码是:
var q = from obj in objTimeLine
join ev in eventsTimeLine
on new {obj.st_year, obj.st_month, obj.st_day} equals new {ev.year, ev.month, ev.day}
select new {obj, ev};
但是如果我做的:
var q = from obj in objTimeLine
join ev in eventsTimeLine
on obj.st_year equals ev.year
select new {obj, ev};
那么有没有错误,一切都很好,但我不知道如何加入比其他两列。
感谢您的帮助这是工作! – Dmitris