-
Notifications
You must be signed in to change notification settings - Fork 592
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
Hash cleanup in C# #2120
Hash cleanup in C# #2120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
_out << nl << "var hash = new global::System.HashCode();"; | ||
assert(dataMembers.size() > 0); // a Slice struct must have at least one field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because we're using the defaults for classes and exceptions.
csharp/src/Ice/Internal/Reference.cs
Outdated
return hashValue_; | ||
} | ||
} | ||
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), _adapterId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include the endpoints in this hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Also added test.
This PR simplifies the implementation of GetHashCode in C# by using the BCL HashCode. It also removes all hash code caching.