我该如何比较两个通用集合?这是我使用两个字符串数组的尝试,但它并不返回true。
namespace genericCollections
{
class Program
{
static void Main(string[] args)
{
string[] xx = new string[] { "gfdg", "gfgfd", "fgfgfd" };
string[] yy = new string[] { "gfdg", "gfgfd", "fgfgfd" };
Console.WriteLine(ComparerCollection(xx, yy).ToString());
Console.ReadKey();
}
static bool ComparerCollection<T>(ICollection<T> x, ICollection<T> y)
{
return x.Equals(y);
}
}
}