如何比较两个通用集合?这是我用两个字符串数组的尝试,但它不返回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);
}
}
}