我有两个列表,即csvlist和emplist csvlist是一个列表(CSV),xml是一个列表(xml)
我正在尝试编写一个linq查询,如果csv.id不等于xml.id,则更新csv.attr。但是,在vb.net中,我不知道运算符不相等。
在C#中你可以使用!=但是vb.net中的等价物>
public class CSV
public property id as string
public property attr as string
end class
public class XML
public property id as string
public property attr as string
end class
Dim csvlist as List(of CSV)
Dim xmllist as List(of XML)
Dim Query = from csv in csvlist, xml in xmllist
where csv.id != xml.id
select xml
Id是一个字母数字字段
答案 0 :(得分:4)
使用Not运算符。
Dim query = From csv In csvlist, xml In xmllist
Where Not csv.id = xml.id
Select xml
至于你的不同部分"
csv中没有重复:
Dim query = From str In csv.Distinct, xml In xmlList Where csv.id <> xml.id
结果集中没有重复项。
Dim query = (From str In csv.Distinct, xml In xmlList Where csv.id <> xml.id).Distinct