如何使用linq加入两个列表 [英] How to join two list using linq
本文介绍了如何使用linq加入两个列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用LINQ加入两个列表.我已使用此查询.
这里的sortlist和objserial是列表.
Hi,
I am joining two Lists using LINQ. i have used this query.
Here sortlist and objserial are lists.
var q = from a in sortList
join b in objSerial on a.ID equals b.Sort
select new
{
a.OrderLine,
a.LineNumber,
a.Mat,
a.DescE,
b.Serial
};
但是我的问题是sortlist.id是一个int值,而objserial.sort是一个int数组,所以它引发了我无法加入的错误.你们能帮我吗,因为我是LINQ的新手.是否有其他方法可以将这两个列表(例如包含")结合在一起.
问候,
S.Inayat Basha
but my problem is that sortlist.id is a int and objserial.sort is a int array, so it''s throws me a error unable to join. can you guys please help me on this, as i am new to LINQ. is there any other method to join these two lists like "contains".
Regards,
S.Inayat Basha
推荐答案
很难找到 ^ ]
这篇关于如何使用linq加入两个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文