Skip to content

Commit

Permalink
Avoid allocating in TimeZoneInfo.GetHashCode() (dotnet/coreclr#8513)
Browse files Browse the repository at this point in the history
Avoid the intermediate ToUpper string allocation.

Commit migrated from dotnet/coreclr@bf4ed11
  • Loading branch information
justinvp authored and jkotas committed Dec 8, 2016
1 parent 07bbec6 commit 311d013
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ static public TimeZoneInfo FromSerializedString(string source) {
// GetHashCode -
//
public override int GetHashCode() {
return m_id.ToUpper(CultureInfo.InvariantCulture).GetHashCode();
return StringComparer.OrdinalIgnoreCase.GetHashCode(m_id);
}

//
Expand Down

0 comments on commit 311d013

Please sign in to comment.