Remove use of string.GetHashCode(StringComparison) (#47883)
authorStephen Toub <stoub@microsoft.com>
Sat, 6 Feb 2021 12:27:37 +0000 (07:27 -0500)
committerGitHub <noreply@github.com>
Sat, 6 Feb 2021 12:27:37 +0000 (07:27 -0500)
commitce0f0b8bc3b39b8aa4b4aa6639fe505679f37c05
treea1e66083cabdb4ae83834fa6832ec16e45a2b776
parent0429344aa272999f01ea312634e651f888d869d9
Remove use of string.GetHashCode(StringComparison) (#47883)

All of our call sites to it pass in a const StringComparison; GetHashCode will then turn around and decide which property on StringComparer to use, and then call GetHashCode on the relevant instance... we may as well just pick the instance directly, which not only saves the lookup and enables devirtualization, it also enables better trimming, as string.GetHashCode(StringComparison) ends up rooting all of the StringComparer properties in case you pass in the appropriate StringComparison.
src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddress.cs
src/libraries/System.Private.Uri/src/System/Uri.cs
src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs