在VB中将Linq语句转换为C#

时间:2018-10-09 10:52:25

标签: c# vb.net linq

我在VB中有以下一行

Dim Totalstock = (From stock In StockInfo.Record, locs In Location.BranchList Where locs.Key.Item1 = "Deliver" And locs.Key.Item2 = stock.WHLO Select stock).ToArray

我需要翻译成C#。我习惯在Linq中使用lambda语句,但是对于此查询,我不知道如何进行转换。

也许有人可以帮助我吗?

1 个答案:

答案 0 :(得分:2)

var Totalstock = (
    from stock in StockInfo.Record
    from locs in Location.BranchList
    where locs.Key.Item1 == "Deliver" && locs.Key.Item2 == stock.WHLO
    select stock).ToArray();