Possible Duplicate:
Comparing two List<string> for equality
How can I find out whether two arrays of string are equal to each other?
I used this, but it does not work, even though the contents of both are the same.
string[] array1 = new string[]{"A" , "B"}
string[] array2 = new string[]{"A" , "B"}
if(array1 == array2) // it return false !!!!
{
//
}
If you have access to Linq, use SequenceEqual
. Otherwise, simply provide the code to first check if the arrays are equal length, and then if items are equal at each index.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With