If you are using .NET FrameWork 3.5 or later, you can use the Linq 'SequenceEqual operator to test for the equality of all elements of two IEnumerables:
string[] ary1 = { "1", "2", "3", "1" };
string[] ary2 = { "1", "2", "3", "1" };
bool isAryEqual = ary1.SequenceEqual(ary2);
If you are going to use 'SequenceEqual, I suggest you study the examples here: [
^].