Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Linq大于或小于等效值_C#_Linq - Fatal编程技术网

C# Linq大于或小于等效值

C# Linq大于或小于等效值,c#,linq,C#,Linq,在SQL中,以下查询按预期返回18条记录 select * from BomTransAction where Quantity <> QauntityToTransfer 然而,在Linq中,我不能使用这个函数。有人能告诉我小于或大于的等效Linq函数是什么吗?即符号 另外,我想知道在这个例子中,我是否需要做两个操作 bomsRefresh.Where(w => w.QauntityToTransfer <> w.Quantity).ToList(); 在S

在SQL中,以下查询按预期返回18条记录

select * from BomTransAction
where Quantity <> QauntityToTransfer
然而,在Linq中,我不能使用这个函数。有人能告诉我小于或大于的等效Linq函数是什么吗?即符号

另外,我想知道在这个例子中,我是否需要做两个操作

bomsRefresh.Where(w => w.QauntityToTransfer  <> w.Quantity).ToList();
在SQL中,该方法不等于

select * from BomTransAction where Quantity <> QuantityToTransfer

如果要查找小于或大于的值,则基本上要查找的是不是w.Quantity的任何值。所以你可以使用不等于,也就是“!=”

使用!=而不是

结果应该是一样的。因为在sql中基本上是一个不相等的操作


然后在linq中,您可以使用!=但不是

这两列都可以为空吗?
bomRefresh.Where(w => w.QuantityToTransfer != w.Quantity).ToList();
select * from BomTransAction
where Quantity != QauntityToTransfer