Avoid Split(new char[]) inside loops (#32601)
authorAlaa Masoud <alaa.masoud@live.com>
Thu, 20 Feb 2020 16:52:19 +0000 (19:52 +0300)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2020 16:52:19 +0000 (11:52 -0500)
src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapDirectoryIdentifier.cs
src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryEntry.cs

index 02e2fde..2d512ca 100644 (file)
@@ -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);
index 7f093c6..78573e9 100644 (file)
@@ -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 = "";