Hello all.
I'm wondering if my method below of comparing an array of strings (or any simple type really) has any performance repercussions.
bool AreValuesEqual(List<string> oldFieldValue, List<string> newFieldValue)
{
if (oldFieldValue.Count != newFieldValue.Count)
return false;
var list1 = oldFieldValue;
list1.AddRange(newFieldValue);
var list2 = list1.Distinct();
return list2.Count() == newFieldIds.Count;
}
I don't know how intensive Distinct() will be for this, but I think it shouldn't be too much compared to another loop.
Edit - Sorry, should have provided more background info. Couple things:
-There will be no duplicates in the parameter arrays.
-I'm not really concerned about order, I just want to know if the values in one array is the same as the other array. If the other array has a different value, return false.