Re: Array equality

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Edward Diener (diener_no_spam_ok_at_ORsoftware.com)
Date: 02/17/05


Date: Thu, 17 Feb 2005 09:40:40 -0500


"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1c7e159ff852112498bd52@msnews.microsoft.com...
> Edward Diener <diener_no_spam_ok@ORsoftware.com> wrote:
>> Is there any System.Array function to test to see if two arrays are
>> equal, meaning the arrays are the same length and contain elements
>> which are equal to each other ? The System.Array.Equals method
>> appears to test only for instance equality, just like object.Equals.
>
> No, there isn't - but the good news is that it's pretty trivial to
> write your own utility method to do it.

Yes, I realize it is pretty trivial to do it. Perhaps I do not understand
the purpose of the overridden System.Object.Equals method but I would have
thought that this should test for object equality rather than instance
equality for derived classes, since one could always test for instance
equality by casting both references to a System.Object.



Relevant Pages

  • Re: HELP! compare two SQL timestamps in C# byte arrays
    ... The problem is I am not testing for Equality. ... > what you could do is use convert it to base64string and compare the ... >> Once I get a couple of SQL timestamps into respective C# byte arrays, ... >> how do convert\manipulate the arrays to something I can compare. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Suggestion of Array#=== which improves case/when behavio
    ... On Sat, 19 Dec 2009, Tony Arcieri wrote: ... to having case equality be essentially == for Arrays. ... Senior Developer, Cyrus Innovation Inc. ...
    (comp.lang.ruby)
  • Re: Help comparing two arrays
    ... Returns true if the two specified arrays of ints are equal to one ... a2 - the other array to be tested for equality. ... of array references are a rough approximation. ... They are not equal because they are really arrays of references to different arrays of int. ...
    (comp.lang.java.programmer)
  • Re: Help comparing two arrays
    ... Returns true if the two specified arrays of ints are equal to one ... a2 - the other array to be tested for equality. ... What you have is an array whose components are arrays of ints. ...
    (comp.lang.java.programmer)
  • Re: How to Abort the logoff procedure
    ... the above line is all about equality. ... Maybe put them into google language tools, ... More equality, rah, rah! ... procedure with an existential exposition on the meaning of meaninglessness. ...
    (microsoft.public.scripting.wsh)