static bool ArraysEqual<T>(T[] a1, T[] a2) { if (ReferenceEquals(a1,a2)) return true; if (a1 == null || a2 == null) return false; if (a1.Length != a2.Length) return false; EqualityComparer<T> comparer = EqualityComparer<T>.Default; for (int i = 0; i < a1.Length; i++) { if (!comparer.Equals(a1[i], a2[i])) return false; } return true; }
method call: bool areArraysEqual = ArraysEqual(userDefinedTrendRules, userTrendRulesMatched);
The original question did not mention the array types and the responder did not ask which sort of implied is was not dependent upon the type.
BTW, there were several other solutions but this one satisfied the original question.
I know there are situations in mt test when all of the elements in the arrays are the same therefore the a true result should have been returned. All tests returned a false condition.
Any help is appreciated.
Also I believe there is a way to put the code into a "code" box that can be scrolled but I do not know how to do that and would appreciate someone showing me how.
Thank you,
Frank
Comment