Skip to content

Commit

Permalink
- Followed existing patterns for string.GetHashCode usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoertz-msft committed Jan 23, 2024
1 parent f9c0946 commit b1cc7d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Controls/src/Xaml/XamlNode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -69,7 +70,17 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
return NamespaceUri.GetHashCode() ^ Name.GetHashCode();
unchecked
{
#if NETSTANDARD2_0
int hashCode = NamespaceUri.GetHashCode();
hashCode = (hashCode * 397) ^ Name.GetHashCode();
#else
int hashCode = NamespaceUri.GetHashCode(StringComparison.Ordinal);
hashCode = (hashCode * 397) ^ Name.GetHashCode(StringComparison.Ordinal);
#endif
return hashCode;
}
}
}

Expand Down

0 comments on commit b1cc7d9

Please sign in to comment.