Use string.Replace for UriBuilder.set_Path
authorJames Ko <jamesqko@gmail.com>
Fri, 1 Jul 2016 13:42:50 +0000 (09:42 -0400)
committerJames Ko <jamesqko@gmail.com>
Fri, 1 Jul 2016 13:42:50 +0000 (09:42 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/0c80ffad824bea91be2afa39e0c49c56608e20e8

src/libraries/System.Private.Uri/src/System/UriBuilder.cs

index 761ad2b..761c67b 100644 (file)
@@ -241,7 +241,7 @@ namespace System
                 {
                     value = "/";
                 }
-                _path = Uri.InternalEscapeString(ConvertSlashes(value));
+                _path = Uri.InternalEscapeString(value.Replace('\\', '/'));
                 _changed = true;
             }
         }
@@ -349,23 +349,6 @@ namespace System
 
         // methods
 
-        private string ConvertSlashes(string path)
-        {
-            StringBuilder sb = new StringBuilder(path.Length);
-            char ch;
-
-            for (int i = 0; i < path.Length; ++i)
-            {
-                ch = path[i];
-                if (ch == '\\')
-                {
-                    ch = '/';
-                }
-                sb.Append(ch);
-            }
-            return sb.ToString();
-        }
-
         public override bool Equals(object rparam)
         {
             if (rparam == null)