Skip to content
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

Provide the ability to take a compare an item using delegates #39

Open
SeanFarrow-RSK opened this issue Jul 20, 2023 · 2 comments
Open
Assignees

Comments

@SeanFarrow-RSK
Copy link

It would be really nice if we could have a method in both the ComparerBuilder and EqualityComparerBuilder classes to allow a member to be compared using delegates for both the equality comparison and the hashcode creation.

Is this currently possible? If not would you accept a PR to implement this?

Thanks,
Sean.

@StephenCleary
Copy link
Owner

allow a member to be compared using delegates for both the equality comparison and the hashcode creation.

What is your use case?

Earlier versions of this library (specifically v1-v4) did have those comparer types. They were deliberately removed because they enable incorrect comparers too easily - having two delegates, no matter how close together, lets them easily get out of sync. The builder API generates comparers where the hash code always has the correct semantics without users having to think about it.

So, v5 of this library removed the delegate-based comparers. I believe the current builder functionality covers any realistic use case. But if you have a use case not already covered by this library, I'd love to hear it!

@StephenCleary StephenCleary self-assigned this Jul 20, 2023
@SeanFarrow-RSK
Copy link
Author

SeanFarrow-RSK commented Jul 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants