TimeZoneInfo: Use string.Concat instead of string.Format (dotnet/coreclr#8540)
authorJustin Van Patten <jvp@justinvp.com>
Fri, 9 Dec 2016 00:44:20 +0000 (16:44 -0800)
committerDan Moseley <danmose@microsoft.com>
Fri, 9 Dec 2016 00:44:20 +0000 (16:44 -0800)
It's more efficient to concatenate the strings.

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

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

index 7d26f83..7758b4e 100644 (file)
@@ -2971,8 +2971,7 @@ namespace System {
 
             try {
                 using (RegistryKey dynamicKey = Registry.LocalMachine.OpenSubKey(
-                                   String.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\Dynamic DST",
-                                       c_timeZonesRegistryHive, id),
+                                   c_timeZonesRegistryHive + "\\" + id + "\\Dynamic DST",
 #if FEATURE_MACL
                                    RegistryKeyPermissionCheck.Default,
                                    System.Security.AccessControl.RegistryRights.ReadKey
@@ -3141,8 +3140,7 @@ namespace System {
                 permSet.Assert();
 
                 using (RegistryKey key = Registry.LocalMachine.OpenSubKey(
-                                  String.Format(CultureInfo.InvariantCulture, "{0}\\{1}",
-                                      c_timeZonesRegistryHive, id),
+                                  c_timeZonesRegistryHive + "\\" + id,
 #if FEATURE_MACL
                                   RegistryKeyPermissionCheck.Default,
                                   System.Security.AccessControl.RegistryRights.ReadKey
@@ -3411,8 +3409,7 @@ namespace System {
                 permSet.Assert();
 
                 using (RegistryKey key = Registry.LocalMachine.OpenSubKey(
-                                  String.Format(CultureInfo.InvariantCulture, "{0}\\{1}",
-                                      c_timeZonesRegistryHive, id),
+                                  c_timeZonesRegistryHive + "\\" + id,
 #if FEATURE_MACL
                                   RegistryKeyPermissionCheck.Default,
                                   System.Security.AccessControl.RegistryRights.ReadKey