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# 从两个列表中获取最不匹配的值<;T>;用C语言实现LINQ#_C#_Linq_List - Fatal编程技术网

C# 从两个列表中获取最不匹配的值<;T>;用C语言实现LINQ#

C# 从两个列表中获取最不匹配的值<;T>;用C语言实现LINQ#,c#,linq,list,C#,Linq,List,我的名单如下: public class matrix { public string Row { get; set; } public string Column { get; set; } public int Value { get; set; } } 因此,在我的主要方法中,以下两个列表具有不同的值 List<matrix> matrixList1 = new List&

我的名单如下:

public class matrix
        {
            public string Row { get; set; }
            public string Column { get; set; }
            public int Value { get; set; }
        }
因此,在我的主要方法中,以下两个列表具有不同的值

List<matrix> matrixList1 = new List<matrix>();

List<matrix> matrixList2 = new List<matrix>();
List matrixList1=新列表();
List matrixList2=新列表();
现在我已经多次尝试从两个列表中查找最不匹配的数据,其中三个属性(即行、列和值)的值将使用LINQ进行更改。实际上,我正在从两个列表“matrixlist1”和“matrixlist2”中查找不匹配的值
其中(matrixlist1.Row!=matrixlist2.Row&&matrixlist1.Column!=matrixlist2.Column&&matrixlist1.Value!=matrixlist2.Value)
。你能帮我一下吗?先谢谢你

类似这样:


var uniqueItems=matrixList1.Where(l1=>!matrixList2.Any(l2=>l1.Row==l2.Row&&l1.Column==l2.Column&&l1.Value==l2.Value))

我不明白你在这里“查找最不匹配的数据”是什么意思。您是否正在查找
list1
中与
list2
中的条目不匹配的条目,因为
不匹配?请使用左外联接。请参阅以下网页:请详细说明您正在尝试执行的操作。否,实际上我正在从两个列表“matrixlist1”和“matrixlist2”中查找不匹配的值,其中(matrixlist1.Row!=matrixlist2.Row&&matrixlist1.Column!=matrixlist2.Column&&matrixlist1.Value!=matrixlist2.Value)。否,实际上,我正在从两个列表“matrixlist1”和“matrixlist2”中查找不匹配的值,其中(matrixlist1.Row!=matrixlist2.Row&&matrixlist1.Column!=matrixlist2.Value!=matrixlist2.Value!=matrixlist2.where(l2=>等),这正是我需要的。非常感谢你。每次,我都没能回答相应的问题&这就是我没有得到正确答案的原因。无论如何,再次非常感谢你。