2
Answers

int[] reference issue

Ask a question
I'm trying to build a high performance windows application that does basic calculations on many different data sets.  Can anyone explain to me why this always returns false???

            int[] x = new int[10] { 10015, 10, 9, 8, 7, 6, 5, 4, 2, 2 };
            int[] y = new int[10] { 10015, 10, 9, 8, 7, 6, 5, 4, 3, 2 };

            if (x.Equals(y)) return true;
            else return false;

I'm pretty sure that .Equals is comparing the ADDRESS of the two arrays, as opposed to the values.  Can someone help me out on what the fastest way of comparing these arrays??  no looping is HIGHLY preferred.

Answers (2)