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

Make the Result class IEquatable<Result> #9

Open
adamradocz opened this issue Aug 29, 2021 · 4 comments
Open

Make the Result class IEquatable<Result> #9

adamradocz opened this issue Aug 29, 2021 · 4 comments

Comments

@adamradocz
Copy link
Contributor

adamradocz commented Aug 29, 2021

I needed in my code to make the Result class IEquatable<Result>. I think because I used it in a Dictionary.
If you are okay with it, I could make a PR for that.

@adamradocz adamradocz changed the title Make the Result class IEquatable<Result> Make the Result and Project class IEquatable<Result> Aug 29, 2021
@adamradocz
Copy link
Contributor Author

adamradocz commented Aug 29, 2021

A checked and I made a few more classes also IEquatable.

@adamradocz adamradocz changed the title Make the Result and Project class IEquatable<Result> Make the Result class IEquatable<Result> Aug 29, 2021
@chausner
Copy link
Owner

It's always possible to define your own IEqualityComparer and use it with Dictionary, for example. I think that might be better than making Result implement IEquatable directly since there are multiple ways how equality could be defined:

  • Two instances are equal if all of their properties are equal. People might want to use this to check if any value changed between two updates.
  • Two instances are equal if they describe the same project. In this case you would only compare MasterUrl and disregard all other properties. A usecase would be to correlate/update data between two updates.

@adamradocz
Copy link
Contributor Author

I don't really agree with you on that, because the Result and the other similar classes should have a clear equality definition, based on how BOINC works.

@chausner
Copy link
Owner

In my previous comment, I gave two examples for possible ways to define equality and corresponding usecases in practice that I think are both valid.

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