compare arrays?

I have two 1D arrays that i would like to compare i.e. if they have all the same values in every index. I am writing this in C#, can someone tell mw the most efficient way of testing equality?

First test if their length are equal, then go through the arrays with a loop and compare the entries. break/return as soon as you found a pair that doesn’t match.

Use System.Linq, and SequenceEqual.

if (array1.SequenceEqual (array2)) {
    // array contents are the same
}

In Unityscript you can just use ==

if (array1 == array2) {
    // array contents are the same
}