我想在我的Equals方法中比较几个集合的内容.我有一个词典和一个IList.有没有内置的方法来做到这一点?
编辑:我想比较两个字典和两个IList,所以我认为平等意味着什么是明确的 - 如果两个字典包含映射到相同值的相同键,那么它们是相等的.
在C#语言规范版本4中,1.6.7.5运算符是有关List<T>运算符的信息:==和!=.但我找不到这样的运营商定义List<T>?我错过了什么吗?
1.6.7.5运算符的示例代码:
List<int> a = new List<int>();
a.Add(1);
a.Add(2);
List<int> b = new List<int>();
b.Add(1);
b.Add(2);
Console.WriteLine(a == b); // Outputs "True" => here I get False as well
b.Add(3);
Console.WriteLine(a == b); // Outputs "False"
Run Code Online (Sandbox Code Playgroud)