[英]Using LINQ to search two lists for match and return boolean for every item
[英]Compare two lists, item by item, using linq
我想逐项比较两个列表。 如何使用linq表达以下代码?
bool result = true;
var list1 = new List<int> { 10, 20, 30, 40 };
var list2 = new List<int> { 10, 20, 30, 40 };
for (int index = 0; index < list1.Count(); index++)
{
result &= list1[index] == list2[index];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.