From 27229c8c10fabe9c689805e68ff225a96664b5cf Mon Sep 17 00:00:00 2001 From: Andrii Siriak Date: Sat, 22 Jun 2019 01:25:09 +0300 Subject: [PATCH] Switch from IndexOf(string) to Contains(string) for better readability and performance (#38757) * Fix performance IndexOf(string) -> Contains(string) * Make comparison ordinal Signed-off-by: dotnet-bot --- src/System.Private.CoreLib/shared/Internal/Win32/RegistryKey.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Private.CoreLib/shared/Internal/Win32/RegistryKey.cs b/src/System.Private.CoreLib/shared/Internal/Win32/RegistryKey.cs index cec8e2f..f66ebf0 100644 --- a/src/System.Private.CoreLib/shared/Internal/Win32/RegistryKey.cs +++ b/src/System.Private.CoreLib/shared/Internal/Win32/RegistryKey.cs @@ -84,7 +84,7 @@ namespace Internal.Win32 public RegistryKey? OpenSubKey(string name, bool writable) { // Make sure that the name does not contain double slahes - Debug.Assert(name.IndexOf("\\\\") == -1); + Debug.Assert(!name.Contains(@"\\")); int ret = Interop.Advapi32.RegOpenKeyEx(_hkey, name, -- 2.7.4