-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in ValueObject.Equals(obj)? #7477
Comments
I also ran into this bug in a project. It would be great to get the example updated. If the objects are identical with the exception of either object having exactly one additional atomic value, the objects will still be considered equal. Saving the result of the MoveNext() calls to a local variable can work around the problem and not require a ToList() on the GetAtomicValues() calls. |
Hi @ZUNNm1Xlwk, @hackked, thanks for the feedback? Well... no doubt you're both right! Would some of you like to contribute a PR to eShopOnContainers repo to fix this? Thanks, |
The current example implementation of the ValueObject.Equals(obj) method returns true for different objects in the following case:
The GetAtromicValues() of the current ValueObject returns 2 objects. The GetAtromicValues() of the ValueObject in the Equals parameter returns 1 object (equal to the first of the current ValueObject).
Nevertheless the count of objects is different the result of an Equals(...) returns true. This is odd.
I fixed this in my code by converting the GetAtomicValues() results to lists and comparing the count of these lists. This is of course not very high performance for huge atomic value collections...
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: