如何比较C#3.0中的两个通用列表? [英] How to compare two generic lists in C# 3.0?

查看:128
本文介绍了如何比较C#3.0中的两个通用列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:


Possible Duplicate:
Is there a built-in method to compare collections in C#?

与C#3.0中的泛型两个通用列表进行比较的最佳方式是什么?

What is the best way to compare to generic two generic lists in C# 3.0?

推荐答案

  • C# List Element Equality

否则:

Otherwise:

var list1 = new List<int> { 1, 2, 3 };
var list2 = new List<int> { 1, 2, 3 };
var areSame = Enumerable.SequenceEqual(list1, list2);

这篇关于如何比较C#3.0中的两个通用列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆