vb.net 中 linq 运算符不等于

use*_*913 1 linq vb.net linq-to-objects

我有两个列表,即 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
Run Code Online (Sandbox Code Playgroud)

Id 是字母数字字段

One*_*Day 5

使用非运算符。

Dim query  = From csv In csvlist, xml In xmllist
             Where Not csv.id = xml.id
             Select xml
Run Code Online (Sandbox Code Playgroud)

至于你独特的部分”

csv 中没有重复项:

Dim query  = From str In csv.Distinct, xml In xmlList Where csv.id <> xml.id
Run Code Online (Sandbox Code Playgroud)

结果集中没有重复项。

Dim query  = (From str In csv.Distinct, xml In xmlList Where csv.id <> xml.id).Distinct
Run Code Online (Sandbox Code Playgroud)