可以使用 Intersect 来检查无序列表的相等性,但是如何使用 LINQ 比较有序列表呢?如果两个序列具有相同顺序的相同元素,则表达式应返回 true。
谢谢
最佳答案
a.SequenceEqual(b);
来自文档:
Returns true if the two source sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type; otherwise, false.
参见 MSDN for more .
关于c# - 如何使用 LINQ 比较两个有序列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6481382/