Avoid allocating in TimeZoneInfo.GetHashCode() (dotnet/coreclr#8513)
authorJustin Van Patten <jvp@justinvp.com>
Thu, 8 Dec 2016 21:21:43 +0000 (13:21 -0800)
committerJan Kotas <jkotas@microsoft.com>
Thu, 8 Dec 2016 21:21:43 +0000 (13:21 -0800)
Avoid the intermediate ToUpper string allocation.

Commit migrated from https://github.com/dotnet/coreclr/commit/bf4ed11eb5cee7123fd0c6fa5b60f09fe7adf23e

src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs

index 5000206..d8662d4 100644 (file)
@@ -969,7 +969,7 @@ namespace System {
         // GetHashCode -
         //
         public override int GetHashCode() {
-            return m_id.ToUpper(CultureInfo.InvariantCulture).GetHashCode();
+            return StringComparer.OrdinalIgnoreCase.GetHashCode(m_id);
         }
 
         //