-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Considering the incorrect usage of GetHashCode in issue #2881, I decided to look through the code to see if there may be similar issues elsewhere. And I might have found a few.
I believe using GetHashCode() to determine equality is wrong, or at least bad practice. Two unequal objects may return the same hash code, depending on the GetHashCode() implementation.
This is from Indices.Equals:
public override bool Equals(object obj)
{
var other = obj as Indices;
if (other == null) return false;
return this.Match(
all => other.Match(a => true, m => false),
many => other.Match(
a => false,
m => this.GetHashCode().Equals(other.GetHashCode())
)
);
}
Similar code in:
Types.Equals
IndexName.EqualsMarker
RelationName.EqualsMarker
TypeName.EqualsMarker
Thoughts on this?
Metadata
Metadata
Assignees
Labels
No labels