Closed rmatherly closed 1 year ago
Thank you for your interest in this project. This repository has been archived and is no longer actively maintained or supported. We appreciate your understanding. Feel free to explore the codebase and adapt it to your own needs if it serves as a useful reference. If you have any further questions or concerns, please refer to the README for more information.
When implementing a ValueObject that can have a variable number of values, I encountered a bug with the Equals overload in ValueObject. Because the MoveNext method is called both in the while statement and the return statement, it will return a false positive when the object on which Equals is called has one more element than the object passed in. One option to fix this would be to store the result of MoveNext for each collection in variables so they are only called once. In my case, I replaced the while loop and return statement with: return GetAtomicValues().SequenceEqual(other.GetAtomicValues()); I found this code on the Microsoft Value Object page here: https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/implement-value-objects.