I would like to compare two lists. If both lists have the same number of elements, the same elements, but in a different order. They should be true, is there a way to achieve this?
bool CheckMatch()
{
if (prueba1 == null && prueba2 == null)
{
return true;
}
else if (prueba1 == null || prueba2 == null)
{
return false;
}
if (prueba1.Count != prueba2.Count)
{
return false;
}
for (int i = 0; i < prueba1.Count; i++)
{
for (int j = 0; j < prueba2.Count; j++)
{
if (prueba1[i] != prueba2[j])
return false;
}
}
return true;
}