From 2f38f64ceb2ece3e57742e798409642565ddfcb0 Mon Sep 17 00:00:00 2001 From: Alaa Masoud Date: Thu, 20 Feb 2020 19:52:19 +0300 Subject: [PATCH] Avoid Split(new char[]) inside loops (#32601) --- .../System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs | 2 +- .../src/System/DirectoryServices/DirectoryEntry.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs index 02e2fde..2d512ca7 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs @@ -35,7 +35,7 @@ namespace System.DirectoryServices.Protocols if (servers[i] != null) { string trimmedName = servers[i].Trim(); - string[] result = trimmedName.Split(new char[] { ' ' }); + string[] result = trimmedName.Split(' '); if (result.Length > 1) { throw new ArgumentException(SR.WhiteSpaceServerName); diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs index 7f093c6..78573e9 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs @@ -1003,7 +1003,7 @@ namespace System.DirectoryServices _propertyCollection.valueTable.Remove(name); // also need to consider the range retrieval case - string[] results = name.Split(new char[] { ';' }); + string[] results = name.Split(';'); if (results.Length != 1) { string rangeName = ""; -- 2.7.4