我有像这样的System.Linq.Enumerable.Join命令
var k = ... (List of size 50)
var r = ... (another List of size 20000)
var joined = k.Join(r,
x => x.joinId,
y => y.somecomplexmember.joinId,
(first, second) => new ResultInternal { k = first, r= second });
据我了解http://msdn.microsoft.com/de-de/library/bb534675(v=vs.110).aspx,这应该执行内连接。结果应该小于或等于k或r的最小长度。但是,"加入"大于50。
我明白了什么不对吗?
谢谢!
答案 0 :(得分:1)
如果您正在寻找内部联接并且只在查询表达式中匹配id,那么您总是可以像简单的where子句一样执行它
var joined=(from x in k from y in r where x.x.joinId==y.somecomplexmember.joinId select new
ResultInternal { k = x, r= y});
查询表达式中的内连接
var joined=(from x in k
join y in r on x.x.joinId equals y.somecomplexmember.joinId
select new ResultInternal { k = x, r= y});