Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
array1="firstname","lastname","company"
array2 is same
but
if I use
bool valid = array1.Equals(array2);
it always return false.why?
Posted

Because an array is always a reference type: which means that Equals compares the two references, not the contents of the array.
Instead, try Enumerable.SequenceEqual[^] which will compare the two array contents.
 
Share this answer
 
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900