[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to correctly use the new Equals()


Also if the values are strings, they are not equal as well
aa = ["cc":"cc"]
ab = ["cc":"cc"]

Do not equal, only numeric values work correctly.


~~~~~ Brian


From: user@xxxxxxxxxxxxxxxxxxxxxx <user@xxxxxxxxxxxxxxxxxxxxxx> on behalf of Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Sent: Wednesday, October 9, 2024 1:46:23 PM
To: user@xxxxxxxxxxxxxxxxxxxxxx <user@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: How to correctly use the new Equals()

Le 09/10/2024 à 18:36, Brian G a écrit :
> This is not equal:
>
>    Public ab As Collection
>    Public aa As Collection
>    aa = ["aa": "aa", "bb": "bb", "cc": ["xx", 1, 2, 3]]
>    ab = ["aa": "aa", "bb": "bb", "cc": ["xx", 1, 2, 3]]
>    If ab.Equals(aa) Then
>         Print "yippy"
>     Else
>         Print "boooo"
>     Endif
>
> Is there a better explanation what equals() actually means when true?
>


It's always the same problem than deep copy: this is not a deep
comparison. Only the values of the keys are compared, and the two arrays
associated with "cc" are different arrays, with the same values, but
different.

In other words, Equals() does not compare the inner values with Equals().

But it could, but that needs more work, and I will do it if it's not
complex.

Regards,

--
Benoît Minisini.




Follow-Ups:
Re: How to correctly use the new Equals()Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
How to correctly use the new Equals()Brian G <brian@xxxxxxxxxxxxxxxx>
Re: How to correctly use the new Equals()Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>