Skip to content

Commit

Permalink
Try fix GetHashCode implementation of the Thickness struct is broken …
Browse files Browse the repository at this point in the history
…for uniform length

dotnet#8789
  • Loading branch information
lindexi committed Feb 18, 2024
1 parent 48200bf commit 9b8fade
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ public bool Equals(Thickness thickness)
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return _Left.GetHashCode() ^ _Top.GetHashCode() ^ _Right.GetHashCode() ^ _Bottom.GetHashCode();
var hashCode = new System.HashCode();
hashCode.Add(_Top);

This comment has been minimized.

Copy link
@davidskula

davidskula Feb 18, 2024

This should be _Left instead of _Top

This comment has been minimized.

Copy link
@xinyuehtx

xinyuehtx via email Feb 18, 2024

This comment has been minimized.

Copy link
@lindexi

lindexi Feb 18, 2024

Author Member

@davidskula Good catch.

hashCode.Add(_Top);
hashCode.Add(_Right);
hashCode.Add(_Bottom);
var code = hashCode.ToHashCode();
return code;
}

/// <summary>
Expand Down

0 comments on commit 9b8fade

Please sign in to comment.